jQ(function(){
	jQ("div.my_clips_menu a.calendar").addClass("calendaronit");
	var html="";
	for(var i=2020;i>=1950;i--){
		html+="<option value='"+i+"'>"+i+"</option>";
	}
	jQ("#mouth_fun_view_year").empty().append(html);
	initUserInterface();
	
	
	getTodayDateInfo();
	
	jQ("#datedetailzone").data("ids","");
	jQ("#mycliplist li:first").data("checked",true);
	
//	initQuickClip();
	initSubscribeList();
	jQ("span.share-title input[name=shareraido]").click(function(){
		var val=eval(jQ(this).val());
		if(val){
			jQ("#share-contactchoose").fadeIn();
		}else{
			jQ("#share-contactchoose").fadeOut();
		}
	});
	jQ("#mycliplist li div.calendardata").bind("mouseout",function(){
		if(jQ(this).hasClass("selecton"))
			return;
		else{
			jQ(this).removeClass("focuson");
		}
	});
	jQ("#mycliplist li div.calendardata").bind("mouseover",function(){
		if(jQ(this).hasClass("selecton"))
			return;
		else{
			jQ(this).addClass("focuson");
		}
	});
	jQ("#mycliplist li div.calendardata").bind("click",function(){
		if(jQ(this).hasClass("selecton"))
			return;
		else{
			jQ("#mycliplist li div.selecton").removeClass("selecton");
			jQ(this).removeClass("focuson").addClass("selecton");
			setMyAllCalendarView();
		}
	});
	jQ("#daydetailhead li").click(function(){
		if(eval(jQ(this).attr("enabled"))){
			if(!jQ(this).hasClass("clickon")){
				var removeclz=jQ("#daydetailhead li.clickon").attr("queryby")+"off";
				jQ("#daydetailhead li.clickon").removeClass().addClass(removeclz);
				var clickonclz=jQ(this).attr("clickonclz");
				jQ(this).removeClass().addClass("clickon").addClass(clickonclz);
				var year=eval(jQ("#datedetailzone").data("year"));
				var month=eval(jQ("#datedetailzone").data("month"));
				var date=eval(jQ("#datedetailzone").data("date"));
				var queryby=jQ(this).attr("queryby");
				jQ("#calendarlist").data("calendarquerytype",queryby);
				if(queryby=='own'){
					jQ("#daydetailcontent ul.content").hide();
					jQ("#clipeventcontent li.ownclip").show();
					jQ("#clipeventcontent li.shareclip").hide();
					jQ("#clipeventcontent").show();
				}
				if(queryby=='invite'){
					jQ("#daydetailcontent ul.content").hide();
					jQ("#inviteeventcontent").show();
				}
				initDayDetailClip(year,month,date,false);
			}
		}
	});
	jQ("#viewopt").dialog({
		modal: true,
		bgiframe: true,
		autoOpen: false,
		closeOnEscape:false,
		draggable:false,
		height:200,
		buttons: {
			
			"确定": function() {
				var opt=jQ("#viewopt");
				var triggerfun=opt.data("function");
				opt.trigger(triggerfun);
				opt.removeData("function");
				jQ("#viewopt_p").hide();
				jQ("#viewopt_img").show();
				activeBtnOnDialog("viewopt",false);
				//jQ(this).dialog('close');
			},
			"取消": function() {
				var viewopt=jQ("#viewopt");
				var triggerfun=jQ("#viewopt").data("function");
				viewopt.unbind(triggerfun);
				viewopt.find("input.eventid").val("");
				viewopt.removeData("function");
				jQ(this).dialog('close');
			}
		},
		close: function() {
			jQ("#viewopt_p").show();
			jQ("#viewopt_img").hide();
			activeBtnOnDialog("viewopt",true);
		},
		open:function(){
		}
	});
	jQ(window.document).bind("scroll",listenWindowScroll);
});

function initUserInterface(){
	var usertype=eval(jQ("#var_usertype").val());
	if(usertype==2){
		jQ("#invitecount").hide();
		jQ("#daydetailhead li.nonequery").css("width","670px");
		jQ("#calendarlist").hide();
		jQ("#mycliplist").hide();
		jQ("#daydetailrequest_tab").hide();
		jQ("#daydetailhead").show();
		jQ("#calendarlist").data("calendarquerytype","own");
		//jQ("#calendar_view_div").css("width","900px");
	}else{
		jQ("#invitecount").show();
		jQ("#calendarlist").show();
		jQ("#mycliplist").show();
		jQ("#daydetailhead").show();
		initContacts();
		
		var liquerymycalendar='own';
		jQ("#calendarlist").data("calendarquerytype","own");
		if(liquerymycalendar=='share'){
//			jQ("#daydetailrequest_tab").show();
//			jQ("#daydetailrequest_tab span.clipcheckbox").bind("click",function(){
//				if(jQ(this).hasClass("clipcheckboxon")){
//					//取消全选
//					jQ("#daydetailcontent li").each(function(){
//						var simpleobj=jQ(this).find("div.simple");
//						var checkbox=simpleobj.find("span.clipcheckbox");
//						if(checkbox.hasClass("clipcheckboxon")){
//							checkbox.removeClass("clipcheckboxon");
//						}
//					});
//					jQ(this).removeClass("clipcheckboxon");
//				}else{
//					jQ("#daydetailcontent li").each(function(){
//						var simpleobj=jQ(this).find("div.simple");
//						var checkbox=simpleobj.find("span.clipcheckbox");
//						if(!checkbox.hasClass("clipcheckboxon")){
//							checkbox.addClass("clipcheckboxon");
//						}
//					});
//					jQ(this).addClass("clipcheckboxon");
//					//全选
//				}
//			});
//			jQ("#daydetailrequest_tab button.invite").bind("click",function(){
//				if(jQ("#daydetailcontent li").length==0){
//					clip_tips("当前日期下没有好友“求活动”");
//				}
//				var count=0;
//				var array=new Array();
//				jQ("#daydetailcontent li").each(function(){
//					var simpleobj=jQ(this).find("div.simple");
//					var checkbox=simpleobj.find("span.clipcheckbox");
//					if(checkbox.hasClass("clipcheckboxon")){
//						count++;
//						var uid=eval(jQ(this).data("unameid"));
//						var flag=true;
//						for(var i=0;i<array.length;i++){
//							if(array[i]==uid){
//								flag=false;
//								break;
//							}
//						}
//						if(flag){
//							array.push(uid);
//						}
//						var str="";
//						for(var i=0;i<array.length;i++){
//							if(i==0){
//								str+=array[i];
//							}else{
//								str+=","+array[i];
//							}
//						}
//						var date=eval(jQ("#datedetailzone").data("date"));
//						var month=eval(jQ("#datedetailzone").data("month"));
//						var year=eval(jQ("#datedetailzone").data("year"));
//						window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?year="+year+"&month="+(month+1)+"&day="+date+"&invites="+str;
//					}
//				});
//				if(count==0){
//					clip_tips("您还没有选择邀请的好友");
//				}else{
//					
//				}
//			});
//			jQ("#daydetailhead").hide();
		}else{
			jQ("#daydetailrequest_tab").hide();
			jQ("#daydetailhead").show();
		}
		
		
		
		
	}
	
}

function listenWindowScroll(){
	var bot = 50;
	if ((jQ(window).scrollTop()-bot) >= 0) {
		jQ("#base_scrollToTop").unbind("click").bind("click",function(){
			jQ(window).scrollTop(0);
		});
		jQ("#base_scrollToTop").show();
		
	}else{
		jQ("#base_scrollToTop").unbind("click");
		jQ("#base_scrollToTop").hide();
	}
}

function initQuickClip(){
	jQ("#quickcontactarea").empty();
	/*jQ("#shareuserauto").autocomplete({
		source: function( request, response ) {
			jQ.ajax({
				url: "contactAjax!getContactsByIpt.action",
				data:{
					nameInput:request.term
				},
				success: function( data ) {
					response(jQ( "user", data ).map(function() {
						return {
							label: jQ("name", this).text(),
							desc: jQ("email", this).text(),
							hasmobile: jQ("hasmobile", this).text(),
							id: jQ(this).attr("id"),
							value:jQ("name", this).text()
						};
					}).get());
				}
			});
		},
		minLength:1,
		select: function( event, ui ) {
			if(ui.item){
				showQuickContact(1,ui.item.id,ui.item.label,ui.item.desc,ui.item.hasmobile,jQ("#shareuserautozone"),false);
			}else{
				showQuickContact(0);
			}
		},
		close: function() {
			jQ( "#shareuserauto" ).val("");
		}
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
	return jQ( "<li></li>" )
		.data( "item.autocomplete", item )
		.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
		.appendTo( ul );
	};*/
	/*
	jQ( "#shareipt" ).autocomplete({
		source: function( request, response ) {
			jQ.ajax({
				url: "contactAjax!getContactsByIpt.action",
				data:{
					nameInput:request.term
				},
				success: function( data ) {
					response(jQ( "user", data ).map(function() {
						return {
							label: jQ("name", this).text(),
							desc: jQ("email", this).text(),
							hasmobile: jQ("hasmobile", this).text(),
							id: jQ(this).attr("id"),
							value:jQ("name", this).text()
						};
					}).get());
				}
			});
		},
		minLength:1,
		select: function( event, ui ) {
			if(ui.item){
				showQuickContact(1,ui.item.id,ui.item.label,ui.item.desc,ui.item.hasmobile,jQ("#quickcontactarea"),true);
			}else{
				showQuickContact(0);
			}
		},
		close: function() {
			jQ( "#shareipt" ).val("");
		}
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
	return jQ( "<li></li>" )
		.data( "item.autocomplete", item )
		.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
		.appendTo( ul );
	};
	*/
	
	
	
	/*jQ.ajax({
		type: "POST",
		url:"userAjax!isHasBindableMobile.action",
		success:function(data){
			var dataObj=eval("("+data+")");//转换为json对象
			if(dataObj.flag){
				//exist
				jQ("#quickclipalertmobile").show();
			}else{
				jQ("#quickclipalertmobile").hide();
			}
		}
	});*/
	jQ("#quickcliptitletab span.clipradiobtn").unbind("click").bind("click",function(){
		if(jQ(this).hasClass("clipradiobtnon"))
			return;
		else{
			jQ("#quickcliptitletab span.clipradiobtnon").removeClass("clipradiobtnon");
			jQ(this).addClass("clipradiobtnon");
			var clipmodel=jQ(this).attr("clipmodel");
			changeAddClipModel(clipmodel);
			
		}
	});
	jQ("#chooseshareinviteradio span.clipradiobtn").unbind("click").bind("click",function(){
		if(jQ(this).hasClass("clipradiobtnon"))
			return;
		else{
			var onobj=jQ("#chooseshareinviteradio span.clipradiobtnon");
			var hideobj=onobj.attr("effectzone");
			jQ("#"+hideobj).hide();
			onobj.removeClass("clipradiobtnon");
			jQ(this).addClass("clipradiobtnon");
			var showobj=jQ(this).attr("effectzone");
			jQ("#"+showobj).show();
			if(showobj.indexOf("share")>0)
				jQ("#td_box_quickclip").data("shareorinvite","share");
			else
				jQ("#td_box_quickclip").data("shareorinvite","invite");
		}
		
	});
	jQ("#quicksharearea-sharechoose div.line span.clipradiobtn").unbind("click").bind("click",function(){
		if(jQ(this).hasClass("clipradiobtnon"))
			return;
		else{
			var onobj=jQ("#quicksharearea-sharechoose div.line span.clipradiobtnon");
			var hideclass=onobj.attr("effectclass");
			jQ(onobj).nextAll("."+hideclass).hide();
			jQ(onobj).nextAll("ul").hide().empty();
			onobj.removeClass("clipradiobtnon");
			jQ(this).addClass("clipradiobtnon");
			var showobj=jQ(this).attr("effectclass");
			jQ(this).nextAll("."+showobj).show();
			if(showobj=='allclass')
				jQ("#quicksharearea").data("share2",1);
			else if(showobj=='groupclass')
				jQ("#quicksharearea").data("share2",2);
			else
				jQ("#quicksharearea").data("share2",3);
			
		}
		
	});
	
	jQ("#quickinvitearea div.invitearea span.clipradiobtn").unbind("click").bind("click",function(){
		if(jQ(this).hasClass("clipradiobtnon"))
			return;
		else{
			var onobj=jQ("#quickinvitearea div.invitearea span.clipradiobtnon");
			var hideclass=onobj.attr("effectclass");
			jQ(onobj).nextAll("."+hideclass).hide();
			jQ(onobj).nextAll("ul").hide().empty();
			onobj.removeClass("clipradiobtnon");
			jQ(this).addClass("clipradiobtnon");
			var showobj=jQ(this).attr("effectclass");
			jQ(this).nextAll("."+showobj).show();
		}
		
	});
	
	jQ("li.line a.minus").mousedown(function(){
		jQ(this).addClass("minusdown");
	});
	jQ("li.line a.minus").mouseup(function(){
		jQ(this).removeClass("minusdown");
	});
	jQ("li.line a.plus").mousedown(function(){
		jQ(this).addClass("plusdown");
	});
	jQ("li.line a.plus").mouseup(function(){
		jQ(this).removeClass("plusdown");
	});
	jQ("input.timeipt").val("").datepicker({  
		yearRange : '1950:2020',
		dateFormat:'yy-mm-dd',
		changeMonth:true,
		changeYear:true,
		beforeShow: function(i,e){  
		var z = jQuery(i).closest(".ui-dialog").css("z-index") + 4;  
		e.dpDiv.css('z-index', z);
		e.dpDiv.css('font', "14px \"Trebuchet MS\", sans-serif");
	}});
	
	jQ("#td_box_quickclip").data("cliptype",1);
	jQ("#td_box_quickclip").data("alert",0);
	jQ("#td_box_quickclip").data("shareorinvite","share");
	if(eval(jQ("#var_hasmobile").val())){
		jQ("#quickclipalertmobile").show();
	}
}

function showsharezone(obj){
	var val=eval(jQ(obj).attr("checked"));
	if(val){
		jQ("#quicksharearea").fadeIn();
	}else
		jQ("#quicksharearea").fadeOut();
}
function showinvitezone(obj){
	var val=eval(jQ(obj).attr("checked"));
	if(val){
		jQ("#quickinvitearea").fadeIn();
		if(jQ("#quickcontactarea").find("li").length>0)
			jQ("#quickcontactarea").fadeIn();
	}else{
		jQ("#quickcontactarea").fadeOut();
		jQ("#quickinvitearea").fadeOut();
	}
}

function changeAddClipModel(model){
	if(model=="addclip"){
		jQ("#td_box_quickclip").data("cliptype",1);
		jQ("#td_box_quickclip").data("alert",0);
		jQ("[model='addclip']").show();
		var val=eval(jQ("#quickclipshareopt").attr("checked"));
		if(val){
			jQ("#quicksharearea").fadeIn();
		}
		val=eval(jQ("#quickclipinviteopt").attr("checked"));
		if(val){
			jQ("#quickinvitearea").fadeIn();
		}
	}else{
		jQ("#td_box_quickclip").data("cliptype",2);
		jQ("#quickclipalertmobile").hide();
		jQ("li.setalert .setalert").fadeOut();
		jQ("#td_box_quickclip").data("alert",0);
		jQ("[model='addclip']").hide();
		if(jQ("#quicksharearea").css("display")!='none'){
			jQ("#quicksharearea").hide();
		}
		if(jQ("#quickinvitearea").css("display")!='none'){
			jQ("#quickinvitearea").hide();
		}
		
	}
}

function changeShareinviteStatus(obj){
	if(jQ(obj).hasClass("clipcheckboxon")){
		jQ(obj).removeClass("clipcheckboxon");
		jQ("#chooseshareinviteradio").hide();
		jQ("#quicksharearea").hide();
		jQ("#quickinvitearea").hide();
		jQ("#td_box_quickclip").data("shareinvite",0);
	}else{
		jQ(obj).addClass("clipcheckboxon");
		jQ("#chooseshareinviteradio").show();
		var ezone=jQ("#chooseshareinviteradio span.clipradiobtnon").attr("effectzone");
		jQ("#"+ezone).show();
		jQ("#td_box_quickclip").data("shareinvite",1);
		var eclass=jQ("#quicksharearea-sharechoose div.line span.clipradiobtnon").attr("effectclass");
		if(eclass=='allclass'){
			jQ("#quicksharearea").data("share2",1);
		}else if(eclass=='groupclass'){
			jQ("#quicksharearea").data("share2",2);
		}else{
			jQ("#quicksharearea").data("share2",3);
		}
	}
}

function changeInviteshareStatus(obj){
	if(jQ(obj).hasClass("clipcheckboxon")){
		jQ(obj).removeClass("clipcheckboxon");
		jQ("#quickinvitearea").data("share",0);
	}else{
		jQ(obj).addClass("clipcheckboxon");
		jQ("#quickinvitearea").data("share",1);
	}
	var eclass=jQ("#quickinvitearea div.invitearea span.clipradiobtnon").attr("effectclass");
	if(eclass=="allclass"){
		jQ("#quickinvitearea").data("share2",1);
	}else{
		jQ("#quickinvitearea").data("share2",2);
	}
	
}

function setAlertStatusChange(obj){
	if(jQ(obj).hasClass("clipcheckboxon")){
		jQ(obj).removeClass("clipcheckboxon");
		jQ("#td_box_quickclip").data("alert",0);
	}else{
		jQ(obj).addClass("clipcheckboxon");
		jQ("#td_box_quickclip").data("alert",1);
	}
}

function showQuickContact(isNormal,id,name,email,hasmobile,zoneobj,isneednotice){
	if(isNormal){
		var flag=false;
		if(zoneobj.css("display")=="none"){
			flag=true;
		}
		var canbeadd=true;
		jQ("li",zoneobj).each(function(){
			var uid=eval(jQ("span.name",this).attr("uid"));
			if(uid==eval(id)){
				canbeadd=false;
				return false;
			}
		});
		if(!canbeadd)
			return;
		var html="<li>";
		html+="<span class='name' title='"+email+"' uid='"+id+"'>"+name+"</span>";
		html+="<div class='opt'>";
		if(isneednotice){
			html+="<a class='email emailonit' title='邮件通知'></a>";
			if(eval(hasmobile))
				html+="<a class='mobilemsg' title='短信通知' onclick='changeMobileStatus(this);'></a>";
		}
		html+="<a class='close' onclick='deleteContact(this);'></a></div></li>";
		zoneobj.append(html);
		if(flag)
			zoneobj.show();
		
	}
}

function deleteContact(obj){
	var liobj=jQ(obj).parent().parent();
	var ulobj=liobj.parent();
	liobj.remove();
	if(jQ("li",ulobj).length==0){
		ulobj.hide();
	}
}

function changeMobileStatus(obj){
	if(jQ(obj).hasClass("mobilemsgonit")){
		jQ(obj).data("mobilenotice",0);
		jQ(obj).removeClass("mobilemsgonit");
	}else{
		jQ(obj).data("mobilenotice",1);
		jQ(obj).addClass("mobilemsgonit");
	}
}

function addclip(){
	if(checkClipData()){
		jQ("#loadingui").show();
		setTimeout(function(){
			submitClipData();
			return true;
		},1500);
	}
}

function submitClipData(){
	var cliptype=eval(jQ("#td_box_quickclip").data("cliptype"));
	var title=jQ.trim(jQ("#quickcliptitle").val());3
	title=title.replace(/\n/g,"");
	title=title.replace(/\r.\n/g,"");
	title=htmlData(title);
	var begindate=jQ("#quickclipdate").datepicker( "getDate" );
	var beginlong=0;
	if(begindate!=null){
		var beginhour=eval(jQ("#quickcliphour").val());
		var beginmin=eval(jQ("#quickclipmin").val());
		if(cliptype==1){
			begindate.setHours(beginhour);
			begindate.setMinutes(beginmin);
		}
		beginlong=begindate.getTime();
	}
	
	var endlong=0;
	var iswholeday=1;
	var alertlong=0;
	var deadlinelong=0;
	var mobilenotice=0;
	var list='';
	var mlist='';
	/*****补充******/
	var eventtype=0;
	var status=1;
	var eventid=0;
	var addressTxt="";
	var contentArea="";
	var sharelist="";
	var share2userlist="";
	var issetalert=eval(jQ("#td_box_quickclip").data("alert"));
	if(issetalert){
		var alertdate=jQ("#quickclipalertdate").datepicker( "getDate" );
		if(alertdate!=null){
			var alerthour=eval(jQ("#quickclipalerthour").val());
			var alertmin=eval(jQ("#quickclipalertmin").val());
			alertdate.setHours(alerthour);
			alertdate.setMinutes(alertmin);
			alertlong=alertdate.getTime();
		}
		if(eval(jQ("#var_hasmobile").val())){
			if(eval(jQ("#quickclipalertmobile").data("mobilenotice"))){
				mobilenotice=1;
			}
		}
	}
	if(cliptype!=2){
		var isshareinvite=eval(jQ("#td_box_quickclip").data("shareinvite"));
		if(isshareinvite){
			var shareorinvite=jQ("#td_box_quickclip").data("shareorinvite");
			if(shareorinvite=='share'){
				cliptype=3;
				var share2val=eval(jQ("#quicksharearea").data("share2"));
				if(share2val==1){
					sharelist="0";
				}else if(share2val==2){
					var tmphtml="";
					jQ("#sharegroupautozone li").each(function(i){
						if(i==0)
							tmphtml=jQ(this).attr("groupid");
						else{
							tmphtml+=","+jQ(this).attr("groupid");
						}
					});
					sharelist=tmphtml;
					
				}else if(share2val==3){
					var tmphtml="";
					jQ("#shareuserautozone li").each(function(i){
						if(i==0)
							tmphtml=jQ(this).find("span.name").attr("uid")
						else{
							tmphtml+=","+jQ(this).find("span.name").attr("uid")
						}
					});
					share2userlist=tmphtml;
				}
			}else{
				list=getContacts();
				mlist=getMobileContacts();
				var inviteshare=eval(jQ("#quickinvitearea").data("share"));
				if(inviteshare){
					cliptype=3;
					var share2val=eval(jQ("#quickinvitearea").data("share2"));
					if(share2val==1){
						sharelist="0";
					}else{
						
						
						var tmphtml="";
						jQ("#quickinvitegroupautozone li").each(function(i){
							if(i==0)
								tmphtml=jQ(this).attr("groupid");
							else{
								tmphtml+=","+jQ(this).attr("groupid");
							}
						});
						sharelist=tmphtml;
					}
				}
				
			}
		}
	}
	
	jQ.ajax({
		type: "POST",
		url:"eventAjax!submitClipData.action",
		data:{
			eventid:eventid,
			cliptype:cliptype,
			title:title,
			address:addressTxt,
			content:contentArea,
			eventtype:eventtype,
			begintime:beginlong,
			endtime:endlong,
			alerttime:alertlong,
			mobilenotice:mobilenotice,
			deadlinetime:deadlinelong,
			contactlist:list,
			mobilelist:mlist,
			sharelist:sharelist,
			share2userlist:share2userlist,
			status:eval(status),
			iswholeday:iswholeday
		},
		success:function(data){
			if(data!=null){
				window.onbeforeunload = null;
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					jQ("#td_box_quickclip").hide();
					if(cliptype==2)
						window.location.href=jQ("#ctxVal").val()+"/myclip/clip_list.html#memo";
					else{
						if(dataObj.cliptype==3){
							jQ("#add_return a.close").unbind("click").bind("click",function(){
								window.location.href=jQ("#ctxVal").val()+"/myclip/clip_list.html";
							})
							initShareOutofSite(dataObj.shareid,title,beginlong);
							jQ("#add_return_wrap").show();
						}else
							window.location.href=jQ("#ctxVal").val()+"/myclip/clip_list.html";
					}
				}else{
					var errzone=jQ("#quickclipinfo");
					errzone.empty();
					errzone.append("数据错误");
					errzone.show();
				}
				jQ("#loadingui").hide();
			}
		}
	});
}

function getContacts(){
	var list=new Array();
	jQ("#quickcontactarea li").each(function(i){
		list.push(jQ("span.name",this).attr("uid"));
	});
	return list.toString();
}

function getMobileContacts(){
	var list=new Array();
	jQ("#quickcontactarea li").each(function(i){
		var mobileobj=jQ("div.opt",this).find("a.mobilemsgonit");
		var flag=jQ("div.opt",this).find("a.mobilemsgonit").length>0;
		if(flag){
			var mobilenotice=mobileobj.data("mobilenotice");
			if(mobilenotice){
				list.push(jQ("span.name",this).attr("uid"));
			}
		}
	});
	return list.toString();
}

function checkClipData(){
	var cliptype=eval(jQ("#td_box_quickclip").data("cliptype"));
	
	var flag=true;
	var title=jQ.trim(jQ("#quickcliptitle").val());
	var errzone=jQ("#quickclipinfo");
	if(title==null||title.length<=0){
	 	errzone.empty();
		errzone.append("请输入内容。");
		errzone.show();
		return false;
	}else{
		if(title.length>50){
			errzone.empty();
			errzone.append("“内容”请控制在50字以内。");
			errzone.show();
		}else
			errzone.empty();
	}
	var beginval=jQ("#quickclipdate").val();
	if(beginval==null||beginval.length<=0){
		errzone.empty();
		if(cliptype==2){
			errzone.append("请选择开始时间。");
		}else
			errzone.append("请选择纪念日时间。");
		errzone.show();
		return false;
	}else{
		errzone.empty();
	}
	var isalert=eval(jQ("#td_box_quickclip").data("alert"));
	if(isalert){
		var alertdateval=jQ("#quickclipalertdate").val();
		if(alertdateval!=null&&alertdateval.length>0){
			var alertdate=jQ("#quickclipalertdate").datepicker( "getDate" );
			var alerthour=eval(jQ("#quickclipalerthour").val());
			var alertmin=eval(jQ("#quickclipalertmin").val());
			alertdate.setHours(alerthour);
			alertdate.setMinutes(alertmin);
			var alertlong=alertdate.getTime();
			var nowdate=new Date();
			nowdate.setTime(eval(jQ("#var_systemtime").val()));
			if(alertlong<nowdate){
				errzone.empty();
				errzone.append("提醒的时间应该是将来的时间。");
				errzone.show();
				return false;
			}else{
				errzone.empty();
			}
		}
	}
	var isshareinvite=eval(jQ("#td_box_quickclip").data("shareinvite"));
	if(isshareinvite){
		var shareorinvite=jQ("#td_box_quickclip").data("shareorinvite");
		if(shareorinvite=='share'){
			var share2val=eval(jQ("#quicksharearea").data("share2"));
			if(share2val==2){
				var templength=jQ("#sharegroupautozone li").length;
				errzone=jQ("#quickclipinfo");
				if(templength==0){
					errzone.empty();
					errzone.append("请至少选择一个指定群组。");
					errzone.show();
					return false;
				}else{
					errzone.empty();
				}
				
			}else if(share2val==3){
				var templength=jQ("#shareuserautozone li").length;
				errzone=jQ("#quickclipinfo");
				if(templength==0){
					errzone.empty();
					errzone.append("请至少选择一个指定好友。");
					errzone.show();
					return false;
				}else{
					errzone.empty();
				}
				
			}
		}else{
			var templength=jQ("#quickcontactarea li").length;
			errzone=jQ("#quickclipinfo");
			if(templength==0){
				errzone.empty();
				errzone.append("请至少选择一个邀请对象。");
				errzone.show();
				return false;
			}else{
				errzone.empty();
			}
			var inviteshare=eval(jQ("#quickinvitearea").data("share"));
			if(inviteshare){
				var share2val=eval(jQ("#quickinvitearea").data("share2"));
				if(share2val===2){
					var templength=jQ("#quickinvitegroupautozone li").length;
					errzone=jQ("#quickclipinfo");
					if(templength==0){
						errzone.empty();
						errzone.append("请至少选择一个指定群组。");
						errzone.show();
						return false;
					}else{
						errzone.empty();
					}
				}
			}
			
		}
	}

	return flag;
}

function hideQuickclip(id){
	window.onbeforeunload = null;
	jQ("#"+id).hide();
}

function addDetailClip(){
	var title=jQ.trim(jQ("#quickcliptitle").val());
	var begindate=jQ("#quickclipdate").datepicker( "getDate" );
	var beginlong=0;
	if(begindate!=null){
		var beginmin=eval(jQ("#quickcliphour").val());
		var beginhour=eval(jQ("#quickclipmin").val());
		begindate.setHours(beginhour);
		begindate.setMinutes(beginmin);
		beginlong=begindate.getTime();
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!savetemp.action",
		data:{
			title:title,
			begintime:beginlong
		},
		success:function(data){
			var dataObj=eval("("+data+")");//转换为json对象
			if(dataObj.result){
				window.onbeforeunload = null;
				jQ("#td_box_quickclip").hide();
				window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?eventid=0";
			}else{
			}
		}
	});
}

function getTodayDateInfo(){
	jQ.ajax({
		type: "POST",
		url:"calendarAjax!getDateInfo.action",
		success:function(data){
			//getTodayEvent();
			if(data!=null&&data.length>0){
				var dataObj=eval("("+data+")");
				var year=dataObj.year;
				var month=dataObj.month;
				var day=dataObj.dayofmonth;
				jQ("#divtodaydetailtime").data("year",year);
				jQ("#divtodaydetailtime").data("month",month);
				jQ("#divtodaydetailtime").data("date",day);
				
				getEventsByMonth(0,0,false,null);
				
				//tY=dataObj.year;
				//tM=dataObj.month;
				//tD=dataObj.day;
				var weeknum=dataObj.weeknum;
				//getEventsByMonth(year,month);
				jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
				jQ("#mouth_fun_view_month option[value='"+(month)+"']").attr("selected",true);
				
				var date=new Date(year, month, day);
				var week=date.getDay();
				var weekStr=day_of_week2cn(week);
				var lunarmonth=dataObj.lunarmonth;
				var lunarday=dataObj.lunarday;
				var lunarholidayday=dataObj.lunarholidayday;
				
				var html="";
				
				html+="<span class='mtime'>今天</span><span>";
				html+=weekStr;
				html+="，";
				html+=year;
				html+="年";
				html+=(month+1);
				html+="月";
				html+=day;
				html+="日，农历";
				html+=lunarmonth;
				html+="";
				html+=lunarday;
				html+=""
				if(lunarholidayday!=""){
					html+="，"+lunarholidayday+"";
				}
				html+="</span>";
				//jQ("#yeatSelect").val(year).change();;
				jQ("#divtodaydetailtime").empty().append(html);
				
			}
		}
	});
}
/**
 * no_mouth weekend today holiday
 * @param 	isss: 是否是订阅日历
 * 			date: 指定某一天 无 则0 有 则>=1
 * */
function getEventsByMonth(yearNum,monthNum,isss,date){
	jQ("#loadingui").show();
	var toyear=eval(jQ("#divtodaydetailtime").data("year"));
	var tomonth=eval(jQ("#divtodaydetailtime").data("month"));
	var todate=eval(jQ("#divtodaydetailtime").data("date"));
	var argslength=arguments.length;
	var querymycalendar;
	var hasdate=(date!=null);
	querymycalendar=jQ("#calendarlist").data("calendarquerytype");
	if(isss==false){
		if(yearNum==0&&monthNum==0){
			jQ("#datedetailzone").data("cyear",toyear);
			jQ("#datedetailzone").data("cmonth",tomonth);
			jQ("#datedetailzone").data("cdate",todate);
			initDayDetailClip(toyear,tomonth,todate,false);
		}else if(yearNum==toyear&&monthNum==tomonth&&hasdate==false){
			jQ("#datedetailzone").data("cyear",toyear);
			jQ("#datedetailzone").data("cmonth",tomonth);
			jQ("#datedetailzone").data("cdate",todate);
			initDayDetailClip(toyear,tomonth,todate,false);
		}else{
			jQ("#mouth_fun_view_year").val(yearNum);
			jQ("#mouth_fun_view_month").val(monthNum);
			jQ("#datedetailzone").data("cyear",yearNum);
			jQ("#datedetailzone").data("cmonth",monthNum);
			if(hasdate){
				jQ("#datedetailzone").data("cdate",date);
				initDayDetailClip(yearNum,monthNum,date,false);
			}else{
				jQ("#datedetailzone").data("cdate",1);
				initDayDetailClip(yearNum,monthNum,1,false);
			}
		}
	}else{
		initDaySubscribeDetailClip(yearNum,monthNum,date,false);
	}
	var ids=jQ("#datedetailzone").data("ids");
	jQ.ajax({
		type: "POST",
		url:"calendarAjax!getEventsByMonth.action",
		data:{
			year:eval(yearNum),
			month:eval(monthNum),
			ids:ids,
			querymycalendar:querymycalendar
		},
		success:function(data){
			var year_month=jQ(data).find("year_month").attr("value");
			var year=eval(year_month.split("_")[0]);
			var month=eval(year_month.split("_")[1]);
			jQ("#calendar_monthcontrolbar").data("currentyear",year);
			jQ("#calendar_monthcontrolbar").data("currentmonth",month);
			var firstDateOfMonth=new Date(year,month,1);
			var week2=firstDateOfMonth.getDay();
			var week1=0;
			var startdate=new Date(year,month,1);
			if(week2>week1){
				startdate.setDate(firstDateOfMonth.getDate() -week2);
			}
			
			var endyear,endmonth;
			if(month==11){
				endmonth=0;
				endyear=year+1;
			}else{
				endmonth=month+1;
				endyear=year;
			}
			
			var endDateOfMonth=new Date(endyear,endmonth,1);
			endDateOfMonth.setDate(endDateOfMonth.getDate() -1);
			var week6=6;
			var week5=endDateOfMonth.getDay();
			
			
			var enddate=new Date(endyear,endmonth,1);
			enddate.setDate(enddate.getDate() -1);
			if(week5<week6){
				enddate.setDate(endDateOfMonth.getDate()+ (week6-week5));
			}
			var index=0;
			var tY=eval(jQ("#divtodaydetailtime").data("year"));
			var tM=eval(jQ("#divtodaydetailtime").data("month"));
			var tD=eval(jQ("#divtodaydetailtime").data("date"));
			jQ("#monthlast1").hide().removeClass();
			jQ("#monthlast2").hide().removeClass();
			while(startdate.getTime()<=enddate.getTime()){
				if(index==28){
					jQ("#monthlast1").show().addClass("monthcontent");
					jQ("#monthlast2").hide().removeClass();
				}else if(index==35){
					jQ("#monthlast2").show().addClass("monthcontent");
				}
				var monthdayObj=jQ("#tdmonth"+index);
				monthdayObj.attr("datetitle",startdate.pattern("yyyy年MM月dd日"));
				var key="month"+startdate.pattern("MMdd");
				monthdayObj.removeClass();
				monthdayObj.addClass("month"+index);
				monthdayObj.data("date",startdate.getTime());
				var obj=jQ(data).find(key);
				var isThisMonth=eval(obj.find("isThisMonth").text());
				
				var isssmonth=eval(obj.find("isssmonth").text());
				if(isssmonth){
					jQ("#tdmonth"+index+" div.eventsign").hide();
					jQ("#tdmonth"+index+" div.data div.noticesign").hide();
					var startsharesize=eval(obj.find("startsharesize").text());
					var endsharesize=eval(obj.find("endsharesize").text());
					jQ("#tdmonth"+index+" div.opt").empty();
					if(startsharesize>0){
						jQ("#tdmonth"+index+" div.opt").append("<a class='sharestart' title='分享开始' ></a>");
					}
					if(endsharesize>0){
						jQ("#tdmonth"+index+" div.opt").append("<a class='shareend' title='分享结束' ></a>");
					}
				}else{
					jQ("#tdmonth"+index+" div.opt").empty();
					var usertype=eval(jQ("#var_usertype").val());
					if(querymycalendar=='own'||usertype==2){
						
						var eventsize=eval(obj.find("hasevent").text());
						jQ("#tdmonth"+index+" div.eventsign").removeClass("requestsign");
						if(eventsize>0){
							jQ("#tdmonth"+index+" div.eventsign").show();
						}else{
							jQ("#tdmonth"+index+" div.eventsign").hide();
						}
					}else if(querymycalendar=='memo'){
						
						var memosize=eval(obj.find("memosize").text());
						jQ("#tdmonth"+index+" div.eventsign").removeClass("requestsign");
						if(memosize>0){
							jQ("#tdmonth"+index+" div.eventsign").show();
						}else{
							jQ("#tdmonth"+index+" div.eventsign").hide();
						}
					}else if(querymycalendar=='share'){
						var startsharesize=eval(obj.find("sharesize").text());
						var signobj=jQ("#tdmonth"+index+" div.eventsign");
						if(startsharesize>0){
							if(!signobj.hasClass("requestsign")){
								signobj.addClass("requestsign").show();
							}
						}else{
							signobj.removeClass("requestsign").hide();
						}
						
					}else if(querymycalendar=='private'){
						jQ("#tdmonth"+index+" div.eventsign").hide();
						jQ("#tdmonth"+index+" div.eventsign").removeClass("requestsign");
						var startsharesize=eval(obj.find("hasevent").text());
						if(startsharesize>0){
							jQ("#tdmonth"+index+" div.eventsign").show();
						}else{
							jQ("#tdmonth"+index+" div.eventsign").hide();
						}
						
					}
					var alerteventsize=eval(obj.find("alerteventsize").text());
					var invitesize=eval(obj.find("invitesize").text());
					monthdayObj.data("alerteventsize",alerteventsize);
					if(alerteventsize>0||invitesize>0){
						jQ("#tdmonth"+index+" div.data div.noticesign").show();
					}else{
						jQ("#tdmonth"+index+" div.data div.noticesign").hide();
					}
//					if(hasacceptinvitedsize>0){
//						jQ("#tdmonth"+index+" div.opt").append("<a class='invite' title='邀请档期' ></a>");
//					}
				}
				var isholiday=eval(obj.attr("holiday"));
				var weeknum=eval(obj.find("weeknum").text());
				var weekofmonth=eval(obj.find("weekofmonth").text());
				var weekday=eval(obj.find("weekday").text());
				var lunartxt=obj.find("lunartxt").text();
				if(isThisMonth){
					monthdayObj.addClass("normal").attr("clickonclz","normalon");
				}else{
					monthdayObj.addClass("othermonth").attr("clickonclz","otheron");
				}
				if(isholiday){
					if(isThisMonth){
						monthdayObj.addClass("holiday");
					}else{
						monthdayObj.addClass("otherholiday");
					}
				}
				jQ("#tdmonth"+index+" div.data p.sun").empty().append(startdate.getDate());
				
				jQ("#tdmonth"+index+" div.data p.lunar").empty().append(lunartxt);
				var year=startdate.getYear()>2000?startdate.getYear():startdate.getYear()+1900;
				if(year==tY && startdate.getMonth()==tM && startdate.getDate()==tD){
					monthdayObj.removeClass("normal").removeClass("holiday").addClass("today").attr("clickonclz","todayon");;
				}
				index++;
				startdate.setDate(startdate.getDate() +1);
			}
			
			jQ("#mouth_fun_prevyear").unbind( "click" );
			jQ("#mouth_fun_prevmonth").unbind( "click" );
			jQ("#mouth_fun_nextyear").unbind( "click" );
			jQ("#mouth_fun_nextmonth").unbind( "click" );
			jQ("#mouth_fun_prevyear").one("click",prevYearClick);
			jQ("#mouth_fun_prevmonth").one("click",prevMonthClick);
			jQ("#mouth_fun_nextyear").one("click",nextYearClick);
			jQ("#mouth_fun_nextmonth").one("click",nextMonthClick);
			
			if(isss||hasdate){
//				if(isss){
//					jQ("#daydetailrequest_tab").hide();
//				}
				var tempdatechoose=new Date();
				tempdatechoose.setFullYear(yearNum);
				tempdatechoose.setMonth(monthNum);
				if(date==null)
					date=1;
				tempdatechoose.setDate(date);
				var attrval=tempdatechoose.pattern("yyyy年MM月dd日");
				var tempobj=jQ("tr.monthcontent td[datetitle='"+attrval+"']");
				var addClz=jQ(tempobj).attr("clickonclz");
				jQ(tempobj).addClass("clickon").addClass(addClz);
				tempobj.find("div.addclip").unbind("click").bind("click",addclipEvent);
				
			}else{
				if(jQ("tr.monthcontent td.today").length>0){
					var tempobj=jQ("tr.monthcontent td.today");
					var addClz=jQ(tempobj).attr("clickonclz");
					jQ(tempobj).addClass("clickon").addClass(addClz);
					tempobj.find("div.addclip").unbind("click").bind("click",addclipEvent);
				}else{
					var tempobj=jQ("tr.monthcontent:first td.normal:first");
					var addClz=jQ(tempobj).attr("clickonclz");
					jQ(tempobj).addClass("clickon").addClass(addClz);
					tempobj.find("div.addclip").unbind("click").bind("click",addclipEvent);
				}
			}
			
			
			
			jQ("tr.monthcontent td").unbind("click").bind("click",function(event){
				if(jQ(this).hasClass("clickon"))
					return;
				else{
					var removedClz=jQ("tr.monthcontent td.clickon").attr("clickonclz");
					jQ("tr.monthcontent td.clickon").removeClass(removedClz).removeClass("clickon");
					var addClz=jQ(this).attr("clickonclz");
					jQ(this).addClass("clickon").addClass(addClz);
					
					jQ(this).find("div.addclip").unbind("click").bind("click",addclipEvent);
					var datetime=eval(jQ(this).data("date"));
					var tempdate=new Date();
					tempdate.setTime(datetime);
					jQ("#datedetailzone").data("cyear",tempdate.getFullYear());
					jQ("#datedetailzone").data("cmonth",tempdate.getMonth());
					jQ("#datedetailzone").data("cdate",tempdate.getDate());
					jQ("#loadingui").show();
					var querytype=jQ("#calendarlist").data("calendarquerytype");
					if(querytype!="cc")	
						initDayDetailClip(tempdate.getFullYear(),tempdate.getMonth(),tempdate.getDate(),true);
					else
						initDaySubscribeDetailClip(tempdate.getFullYear(),tempdate.getMonth(),tempdate.getDate(),true);
				}
			});
			jQ("#loadingui").hide();
		}
	});
}

function addclipEvent(){
//	var box = jQ(this).offset();
//	var b_iw = jQ("ul.main").offset();
//	var w_iw = jQ("ul.main").width();
//	var bg_position = b_iw.left + w_iw;
//	var box_position = box.left + jQ("#td_box_quickclip").width();
//	if(box_position>bg_position){
//		jQ("#td_box_quickclip").css({"top":box.top,"left":bg_position - jQ("#td_box_quickclip").width()});
//	}
//	else{
//		jQ("#td_box_quickclip").css({"top":box.top,"left":box.left});
//	}
//	window.onbeforeunload = leavenotice;
//	var errzone=jQ("#quickclipinfo");
//	errzone.empty();
//	var temp=new Date();
	var year=eval(jQ("#datedetailzone").data("cyear"));
	var month=eval(jQ("#datedetailzone").data("cmonth"));
	var date=eval(jQ("#datedetailzone").data("cdate"));
	window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?year="+year+"&month="+(month+1)+"&day="+date;
//	temp.setFullYear(year);
//	temp.setMonth(month);
//	temp.setDate(date);
//	jQ("#quickclipdate").datepicker("setDate",temp);
//	jQ("#quickcliptitle").val("");
//	jQ("#quickclipalertdate").val("");
//	jQ("#shareipt").val("");
//	jQ("#quickcontactarea").empty().hide();
//	jQ("#td_box_quickclip").show();
//	scrollToObject(jQ("#td_box_quickclip"));
}

function initDayDetailClip(year,month,date,isneedcloseloading){
	//jQ(window.document).unbind("scroll",listenScroll);
	jQ("#datedetailzone").data("date",date);
	jQ("#datedetailzone").data("month",month);
	jQ("#datedetailzone").data("year",year);
	var queryby=jQ("#calendarlist").data("calendarquerytype");
	var tmp=year;
	jQ("#daydetailcontent").empty();
	addLoadingLine();
	jQ.ajax({
		type: "POST",
		url:"eventAjax!getAllEventsByDay.action",
		data:{
			year:year,
			month:month,
			date:date,
			queryby:queryby
		},
		success:function(data){
			removeLoadingLine();
			orgDayDetailClip(data,0,queryby);
			if(isneedcloseloading)
				jQ("#loadingui").hide();
			/*setTimeout(function(){
			},1000);*/
		}
	});
}

var loadmaxlength=10;

function listenScroll() {
	if(jQ("#daydetailcontent li.lastline").length>0){
		var bot = 50;
		if ((bot + jQ(window).scrollTop()) >= (jQ(document).height() - jQ(window).height())) {
			jQ(window.document).unbind("scroll",listenScroll);
			addLoadingLine();
			var ids=jQ("#datedetailzone").data("ids");
			if(ids.length>0)
				setTimeout(continueLoadSSDaysEvent,1500);
			else
				setTimeout(continueLoadDaysEvent,1500);
		}
	}
}

function addLoadingLine(){
	if(jQ("#daydetailcontent li.loadingline").length>0)
		return;
	var html="<li class=\"dataline loadingline\">";
	html+="<div class=\"simple\">";
	html+=jQ("#loadingline").clone().html();
	html+="</div>";
	html+="</li>";
	if(jQ("#daydetailcontent li").length==0)
		jQ("#daydetailcontent").append(html);
	else
		jQ("#daydetailcontent li.lastline").after(html);
}
function removeLoadingLine(){
	jQ("#daydetailcontent li.loadingline").remove();
}

function continueLoadDaysEvent(){
	jQ(window.document).unbind("scroll",listenScroll);
	
	var date=eval(jQ("#datedetailzone").data("date"));
	var month=eval(jQ("#datedetailzone").data("month"));
	var year=eval(jQ("#datedetailzone").data("year"));
	var queryby=jQ("#daydetailhead li.clickon").attr("queryby");
	// contacttype 应有记录读取
	jQ.ajax({
		type: "POST",
		url:"eventAjax!getAllEventsByDay.action",
		data:{
			year:year,
			month:month,
			date:date,
			queryby:queryby,
			needmore:1
		},
		success:function(data){
			removeLoadingLine();
			jQ("#daydetailcontent li.lastline").removeClass("lastline");
			orgDayDetailClip(data,1,queryby);
		}
	});
}

function continueLoadSSDaysEvent(){
	jQ(window.document).unbind("scroll",listenScroll);
	
	var date=eval(jQ("#datedetailzone").data("date"));
	var month=eval(jQ("#datedetailzone").data("month"));
	var year=eval(jQ("#datedetailzone").data("year"));
	var ids=jQ("#datedetailzone").data("ids")
	// contacttype 应有记录读取
	jQ.ajax({
		type: "POST",
		url:"eventAjax!loadSubscribeEvents.action",
		data:{
			year:year,
			month:month,
			date:date,
			ids:ids,
			needmore:1
		},
		success:function(data){
			removeLoadingLine();
			jQ("#daydetailcontent li.lastline").removeClass("lastline");
			orgDayDetailClip(data,1);
		}
	});
	
}

function orgDayDetailClip(data,needmore,queryby){
	var cliphtml="";
	if(needmore==0){
		var alertcount=eval(jQ(data).find("alertcount").text());
		var invitecount=eval(jQ(data).find("invitecount").text());
		alertcount=alertcount>99?"99+":alertcount;
		invitecount=invitecount>99?"99+":invitecount;
		jQ("#alertcount span").empty().append(alertcount);
		jQ("#invitecount span").empty().append(invitecount);
	}
	var length=0;
	var needaddemptyblank=false;
	var emptyblanklength=0;
	if(queryby=="own"||queryby=="share"){
		length=jQ(data).find("ClipEvent").length;
	}else if(queryby=="memo"){
		length=jQ(data).find("MemoEvent").length;
	}else if(queryby=="invite"){
		length=jQ(data).find("InviteEvent").length;
	}else if(queryby=="alert"){
		length=jQ(data).find("AlertEvent").length;
	}else
		length=jQ(data).find("ClipEvent").length;
	if(length==0&&needmore==0){
		var emptyhtml="";
		for(var i=0;i<5;i++){
			emptyhtml+="<li class=\"nodata\" >";
			emptyhtml+="<div class='simple'>";
			if(i==0){
				emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
			}
			emptyhtml+="</div>";
			emptyhtml+="</li>";
		}
		jQ("#daydetailcontent").append(emptyhtml);
		return;
	}else{
		if(length<5&&length>0&&needmore==0){
			needaddemptyblank=true;
			emptyblanklength=5-length;
		}
	}
	var currentusertype=eval(jQ("#var_usertype").val());
	jQ(data).find("ClipEvent").each(function(){
		var id=eval(jQ(this).attr("id"));//
		var uid=jQ(this).find("unameid").text();//
		var userlogo=jQ(this).find("unameslogo").text();
		var title=jQ(this).find("title").text();//\\
		var eventtype=eval(jQ(this).find("eventtype").text());
		var seid=eval(jQ(this).find("seid").text());
		var uname=jQ(this).find("uname").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var timesituation=eval(jQ(this).find("timesituation").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var isuserself=eval(jQ(this).attr("isuserself"));
		var eventisinterested=eval(jQ(this).find("eventisinterested").text());
		var isconfirmevent=jQ(this).find("isconfirmevent").text();
		var invitetime=jQ(this).find("invitetime").text();
		var clipiscc=eval(jQ(this).find("clipiscc").text());
		if(reliedclip==0){
			if(eventisinterested){
				cliphtml+="<li class=\"dataline shareclip\" id=clipevent-"+id+">";
				cliphtml+="<div class='simple' style='background:#fde9eb'>";
			}else{
				cliphtml+="<li class=\"dataline ownclip\" id=clipevent-"+id+">";
				cliphtml+="<div class='simple'>";
			}
		}else{
			cliphtml+="<li class=\"dataline shareclip\" id=clipevent-"+id+">";
			cliphtml+="<div class='simple' style='background:#fde9eb'>";
		}
		if(cliptype==4&&isuserself==false){
			cliphtml+="<span class=\"clipcheckbox\"></span>";
		}
			cliphtml+="<span class=\"head\" style=\"background:url('"+userlogo+"');\"></span>";
			cliphtml+="<span class=\"name\">";
			var length=getWordsLength(uname,12);
			if(length>100){
				cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' class='maxname' title='"+uname+"'>"+uname+"</a>";
			}else{
				cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' title='"+uname+"'>"+uname+"</a>";
			}
			if(clipiscc||(currentusertype==2&&isuserself)){
				cliphtml+="<span class=\"v_icon\" title='档期认证'></span>";
			}
			cliphtml+="</span>";
			if(eventtype==2&&typeof(invitetime)!='undefined'&&eval(invitetime)>0){
				cliphtml+="<span class=\"time\">"+formateDetailTime(eval(invitetime))+"</span>";
			}else{
				if(iswholeday){
					cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+"</span>";
				}else{
					cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+" - "+formateDetailTime(endtime)+"</span>";
				}
			}
			if(cliptype==1){
				cliphtml+="<img class='pr' src=\""+jQ("#ctxVal").val()+"/image/clipevent_private.png\" title='私人档期'></img>";
			}else if(cliptype==3){
				if(eventtype==2&&(seid==0||seid==reliedclip)){
					
				}else{
					if(typeof(isconfirmevent)!='undefined'&&eval(isconfirmevent)==true){
						cliphtml+="<img class='ce' src=\""+jQ("#ctxVal").val()+"/image/clipmessage_confirmicon.png\" title='一拍即合'></img>";
					}
					cliphtml+="<img class='ri' src=\""+jQ("#ctxVal").val()+"/image/clipevent_invite.png\" title='活动邀请'></img>";
				}
			}else if(cliptype==4){
				cliphtml+="<img class='ri' src=\""+jQ("#ctxVal").val()+"/image/clipevent_request.png\" title='求活动'></img>";
			}
			cliphtml+="<span class=\"title\">"+title+"</span>";
			cliphtml+="<span class=\"ocopen\"></span>";
			//cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+"</span>";
			cliphtml+="</div>";
			cliphtml+="<div class='detail' style='display:none;'>";
			cliphtml+="</div>";
		cliphtml+="</li>";
	});
	
	jQ(data).find("MemoEvent").each(function(){
		var id=eval(jQ(this).attr("id"));//
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var clocktime=eval(jQ(this).find("clocktime").text());
		var uid=jQ(this).find("unameid").text();
		var userlogo=jQ(this).find("unamelogo").text();
		var uname=jQ(this).find("uname").text();
		
		cliphtml+="<li class=\"dataline ownclip\" id=memoevent-"+id+">";
		cliphtml+="<div class='simple'>";
		cliphtml+="<span class=\"head\" style=\"background:url('"+userlogo+"');\"></span>";
		cliphtml+="<span class=\"name\">"+uname+"</span>";
		cliphtml+="<span class=\"time\">"+formateTimeMonthDate(starttime)+"</span>";
		cliphtml+="<span class=\"title\">"+title+"</span>";
		cliphtml+="<span class=\"ocopen\"></span>";
		cliphtml+="</div>";
		cliphtml+="<div class='detail' style='display:none;'>";
		cliphtml+="</div>";
		cliphtml+="</li>";
	});
	
	jQ(data).find("InviteEvent").each(function(){
		var id=eval(jQ(this).attr("id"));//
		var uid=jQ(this).find("unameid").text();//
		var userlogo=jQ(this).find("unameslogo").text();
		var title=jQ(this).find("title").text();//
		var pname=jQ(this).find("uname").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var timesituation=eval(jQ(this).find("timesituation").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var clipusertype=eval(jQ(this).find("clipusertype").text());
		var eventisinterested=eval(jQ(this).find("eventisinterested").text());
		var invitetime=jQ(this).find("invitetime").text();
		var eventtype=eval(jQ(this).find("eventtype").text());
		var isconfirmevent=jQ(this).find("isconfirmevent").text();
		cliphtml+="<li class=\"dataline shareclip\" id=inviteevent-"+id+">";
		if(eventisinterested==0){
			cliphtml+="<div class='simple'>";
		}else{
			cliphtml+="<div class='simple' style='background:#fde9eb'>";
		}
		cliphtml+="<span class=\"head\" style=\"background:url('"+userlogo+"');\"></span>";
		cliphtml+="<span class=\"name\">";;
		var length=getWordsLength(pname,12);
		if(length>100){
			cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' class='maxname' title='"+pname+"'>"+pname+"</a>";
		}else{
			cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' title='"+pname+"'>"+pname+"</a>";
		}
		if(clipusertype==2){
			cliphtml+="<span class='v_icon' title='档期认证'></span>";
		}
		cliphtml+="</span>";
		if(eventtype==2&&typeof(invitetime)!='undefined'&&eval(invitetime)>0){
				cliphtml+="<span class=\"time\">"+formateDetailTime(eval(invitetime))+"</span>";
		}else{
			if(iswholeday){
				cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+"</span>";
			}else{
				cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+" - "+formateDetailTime(endtime)+"</span>";
			}
		}
		if(typeof(isconfirmevent)!='undefined'&&eval(isconfirmevent)==true)
			cliphtml+="<img class='ce' src=\""+jQ("#ctxVal").val()+"/image/clipmessage_confirmicon.png\" title='一拍即合'></img>";
		cliphtml+="<img class='ri' src=\""+jQ("#ctxVal").val()+"/image/clipevent_invite.png\" title='活动邀请'></img>";
		cliphtml+="<span class=\"title\">"+title+"</span>";
		cliphtml+="<span class=\"ocopen\"></span>";
		cliphtml+="</div>";
		cliphtml+="<div class='detail' style='display:none;'>";
		cliphtml+="</div>";
		cliphtml+="</li>";
	});
	
	jQ(data).find("AlertEvent").each(function(){
		var id=eval(jQ(this).attr("id"));//
		var uid=jQ(this).find("unameid").text();//
		var userlogo=jQ(this).find("unamelogo").text();
		var title=jQ(this).find("title").text();//
		//var eventtype=jQ(this).find("eventtype").text();//
		var isshareaccept=eval(jQ(this).find("isshareaccept").text());//
		var uname=jQ(this).find("uname").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var timesituation=eval(jQ(this).find("timesituation").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var starttime=eval(jQ(this).find("starttime").text());
		var clipusertype=eval(jQ(this).find("clipusertype").text());
		cliphtml+="<li class=\"dataline ownclip\" id=alertevent-"+id+">";
		if(isshareaccept)
			cliphtml+="<div class='simple' style='background:#fde9eb'>";
		else
			cliphtml+="<div class='simple'>";
		cliphtml+="<span class=\"head\" style=\"background:url('"+userlogo+"');\"></span>";
		cliphtml+="<span class=\"name\">";;
		var length=getWordsLength(uname,12);
		if(length>100){
			cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' class='maxname' title='"+uname+"'>"+uname+"</a>";
		}else{
			cliphtml+="<a href='"+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"' title='"+uname+"'>"+uname+"</a>";
		}
		if(clipusertype==2){
			cliphtml+="<span class='v_icon' title='档期认证'></span>";
		}
		cliphtml+="</span>";
		cliphtml+="<span class=\"title\">"+title+"</span>";
		cliphtml+="<span class=\"ocopen\"></span>";
		cliphtml+="<span class=\"time\">"+formateDetailTime(starttime)+"</span>";
		cliphtml+="</div>";
		cliphtml+="<div class='detail' style='display:none;'>";
		cliphtml+="</div>";
		cliphtml+="</li>";
	});
	if(needaddemptyblank){
		for(var i=0;i<emptyblanklength;i++){
			cliphtml+="<li class=\"dataline nodata\" >";
			cliphtml+="<div class='simple'>";
			cliphtml+="</div>";
			cliphtml+="</li>";
		}
	}
	jQ("#daydetailcontent").append(cliphtml);
	jQ(data).find("ClipEvent").each(function(){
		var id=jQ(this).attr("id");
		var isself=jQ(this).find("isself").text();
		var isuserself=jQ(this).attr("isuserself");
		var uname=jQ(this).find("uname").text();
		var unameid=jQ(this).find("unameid").text();
		var unamelogo=jQ(this).find("unamelogo").text();
		var unameslogo=jQ(this).find("unameslogo").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var seid=eval(jQ(this).find("seid").text());
		if(seid>0){
			var sourceeventid=jQ(this).find("sourceeventid").text();
			var sourceuid=eval(jQ(this).find("sourceuid").text());
			var sourceuname=jQ(this).find("sourceuname").text();
			var sourceulogo=jQ(this).find("sourceulogo").text();
			jQ("#clipevent-"+id).data("sourceeventid",sourceeventid);
			jQ("#clipevent-"+id).data("sourceuid",sourceuid);
			jQ("#clipevent-"+id).data("sourceuname",sourceuname);
			jQ("#clipevent-"+id).data("sourceulogo",sourceulogo);
		}
		var shareid=jQ(this).find("shareid").text();
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var content=jQ(this).find("content").text();
		var clocktime=eval(jQ(this).find("clocktime").text());
		var clipstatus=eval(jQ(this).find("clipstatus").text());
		var eventtype=eval(jQ(this).find("eventtype").text());
		var timesituation=eval(jQ(this).find("timesituation").text());
		var processstatus=eval(jQ(this).find("processstatus").text());
		var isconfirmevent=eval(jQ(this).find("isconfirmevent").text());
		var eventisinterested=eval(jQ(this).find("eventisinterested").text());
		var clipeventpic=jQ(this).find("clipeventpic").text();
		var isshielded=eval(jQ(this).find("isshielded").text());
		var clipiscc=eval(jQ(this).find("clipiscc").text());
		var invitetime=jQ(this).find("invitetime").text();
		jQ("#clipevent-"+id).data("eventid",id);
		jQ("#clipevent-"+id).data("isself",isself);
		jQ("#clipevent-"+id).data("isuserself",isuserself);
		jQ("#clipevent-"+id).data("uname",uname);
		jQ("#clipevent-"+id).data("unameid",unameid);
		jQ("#clipevent-"+id).data("unamelogo",unamelogo);
		jQ("#clipevent-"+id).data("unameslogo",unameslogo);
		jQ("#clipevent-"+id).data("reliedclip",reliedclip);
		jQ("#clipevent-"+id).data("cliptype",cliptype);
		jQ("#clipevent-"+id).data("seid",seid);
		jQ("#clipevent-"+id).data("shareid",shareid);
		jQ("#clipevent-"+id).data("title",title);
		jQ("#clipevent-"+id).data("starttime",starttime);
		jQ("#clipevent-"+id).data("endtime",endtime);
		jQ("#clipevent-"+id).data("iswholeday",iswholeday);
		jQ("#clipevent-"+id).data("content",content);
		jQ("#clipevent-"+id).data("clocktime",clocktime);
		jQ("#clipevent-"+id).data("clipstatus",clipstatus);
		jQ("#clipevent-"+id).data("eventtype",eventtype);
		jQ("#clipevent-"+id).data("timesituation",timesituation);
		jQ("#clipevent-"+id).data("processstatus",processstatus);
		jQ("#clipevent-"+id).data("isconfirmevent",isconfirmevent);
		jQ("#clipevent-"+id).data("eventisinterested",eventisinterested);
		jQ("#clipevent-"+id).data("clipeventpic",clipeventpic);
		jQ("#clipevent-"+id).data("isshielded",isshielded);
		jQ("#clipevent-"+id).data("clipiscc",clipiscc);
		jQ("#clipevent-"+id).data("invitetime",invitetime);
	});
	
	jQ(data).find("MemoEvent").each(function(){
		var id=eval(jQ(this).attr("id"));//
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var uname=jQ(this).find("uname").text();
		var unameid=jQ(this).find("unameid").text();
		var unamelogo=jQ(this).find("unamelogo").text();
		var clocktime=jQ(this).find("clocktime").text();
		jQ("#memoevent-"+id).data("eventid",id);
		jQ("#memoevent-"+id).data("title",title);
		jQ("#memoevent-"+id).data("unamelogo",unamelogo);
		jQ("#memoevent-"+id).data("unameid",unameid);
		jQ("#memoevent-"+id).data("uname",uname);
		jQ("#memoevent-"+id).data("clocktime",clocktime);
		jQ("#memoevent-"+id).data("starttime",starttime);
		jQ("#memoevent-"+id).data("cliptype",2);
	});
	
	jQ(data).find("InviteEvent").each(function(){
		var id=jQ(this).attr("id");
		var isself=jQ(this).find("isself").text();
		var isuserself=jQ(this).attr("isuserself");
		var uname=jQ(this).find("uname").text();
		var unameid=jQ(this).find("unameid").text();
		var unamelogo=jQ(this).find("unamelogo").text();
		var unameslogo=jQ(this).find("unameslogo").text();
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var cliptype=eval(jQ(this).find("cliptype").text());
		var seid=eval(jQ(this).find("seid").text());
		if(seid>0){
			var sourceeventid=jQ(this).find("sourceeventid").text();
			var sourceuid=eval(jQ(this).find("sourceuid").text());
			var sourceuname=jQ(this).find("sourceuname").text();
			var sourceulogo=jQ(this).find("sourceulogo").text();
			jQ("#inviteevent-"+id).data("sourceeventid",sourceeventid);
			jQ("#inviteevent-"+id).data("sourceuid",sourceuid);
			jQ("#inviteevent-"+id).data("sourceuname",sourceuname);
			jQ("#inviteevent-"+id).data("sourceulogo",sourceulogo);
		}
		var shareid=jQ(this).find("shareid").text();
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var content=jQ(this).find("content").text();
		var clocktime=eval(jQ(this).find("clocktime").text());
		var clipstatus=eval(jQ(this).find("clipstatus").text());
		var eventtype=eval(jQ(this).find("eventtype").text());
		var timesituation=eval(jQ(this).find("timesituation").text());
		var processstatus=eval(jQ(this).find("processstatus").text());
		var isconfirmevent=eval(jQ(this).find("isconfirmevent").text());
		var eventisinterested=eval(jQ(this).find("eventisinterested").text());
		var clipeventpic=jQ(this).find("clipeventpic").text();
		var isshielded=eval(jQ(this).find("isshielded").text());
		var invitetime=jQ(this).find("invitetime").text();
		jQ("#inviteevent-"+id).data("eventid",id);
		jQ("#inviteevent-"+id).data("isself",isself);
		jQ("#inviteevent-"+id).data("isuserself",isuserself);
		jQ("#inviteevent-"+id).data("uname",uname);
		jQ("#inviteevent-"+id).data("unameid",unameid);
		jQ("#inviteevent-"+id).data("unamelogo",unamelogo);
		jQ("#inviteevent-"+id).data("unameslogo",unameslogo);
		jQ("#inviteevent-"+id).data("reliedclip",reliedclip);
		jQ("#inviteevent-"+id).data("cliptype",cliptype);
		jQ("#inviteevent-"+id).data("seid",seid);
		jQ("#inviteevent-"+id).data("shareid",shareid);
		jQ("#inviteevent-"+id).data("title",title);
		jQ("#inviteevent-"+id).data("starttime",starttime);
		jQ("#inviteevent-"+id).data("endtime",endtime);
		jQ("#inviteevent-"+id).data("iswholeday",iswholeday);
		jQ("#inviteevent-"+id).data("content",content);
		jQ("#inviteevent-"+id).data("clocktime",clocktime);
		jQ("#inviteevent-"+id).data("clipstatus",clipstatus);
		jQ("#inviteevent-"+id).data("eventtype",eventtype);
		jQ("#inviteevent-"+id).data("timesituation",timesituation);
		jQ("#inviteevent-"+id).data("processstatus",processstatus);
		jQ("#inviteevent-"+id).data("isconfirmevent",isconfirmevent);
		jQ("#inviteevent-"+id).data("eventisinterested",eventisinterested);
		jQ("#inviteevent-"+id).data("clipeventpic",clipeventpic);
		jQ("#inviteevent-"+id).data("isshielded",isshielded);
		jQ("#inviteevent-"+id).data("invitetime",invitetime);
	});
	
	jQ(data).find("AlertEvent").each(function(){
		var reliedclip=eval(jQ(this).find("reliedclip").text());
		var processstatus=eval(jQ(this).find("processstatus").text());//
		var id=eval(jQ(this).attr("id"));//
		var title=jQ(this).find("title").text();//
		var starttime=eval(jQ(this).find("starttime").text());
		var endtime=eval(jQ(this).find("endtime").text());
		var iswholeday=eval(jQ(this).find("iswholeday").text());
		var address=jQ(this).find("address").text();
		var content=jQ(this).find("content").text();
		var pname=jQ(this).find("pname").text();
		var uname=jQ(this).find("uname").text();
		var unameid=jQ(this).find("unameid").text();
		var pnameid=jQ(this).find("pnameid").text();
		
		var unamelogo=jQ(this).find("unamelogo").text();
		var pnamelogo=jQ(this).find("pnamelogo").text();
		
		var isself=jQ(this).find("isself").text();
		var isshareaccept=eval(jQ(this).find("isshareaccept").text());
		var isinviteaccept=eval(jQ(this).find("isinviteaccept").text());
		var acceptshareid=jQ(this).find("acceptshareid").text();
		var cliptype=eval(jQ(this).find("cliptype").text());
		var shareid=jQ(this).find("shareid").text();
		var clocktime=jQ(this).find("clocktime").text();
		var isinviteevent=jQ(this).find("isinviteevent").text();
		var clipusertype=eval(jQ(this).find("clipusertype").text());
		var reliedclipusertype=eval(jQ(this).find("reliedclipusertype").text());
		var clipeventpic=jQ(this).find("clipeventpic").text();
		var isshielded=eval(jQ(this).find("isshielded").text());
		jQ("#alertevent-"+id).data("eventid",id);
		jQ("#alertevent-"+id).data("title",title);
		
		jQ("#alertevent-"+id).data("unamelogo",unamelogo);
		jQ("#alertevent-"+id).data("pnamelogo",pnamelogo);
		jQ("#alertevent-"+id).data("clipstatus",jQ(this).find("clipstatus").text());
		//jQ("#alertevent-"+id).data("eventtype",eventtype);
		jQ("#alertevent-"+id).data("starttime",starttime);
		jQ("#alertevent-"+id).data("endtime",endtime);
		jQ("#alertevent-"+id).data("iswholeday",iswholeday);
		jQ("#alertevent-"+id).data("address",address);
		jQ("#alertevent-"+id).data("content",content);
		jQ("#alertevent-"+id).data("processstatus",processstatus);
		jQ("#alertevent-"+id).data("reliedclip",reliedclip);
		jQ("#alertevent-"+id).data("pname",pname);
		jQ("#alertevent-"+id).data("uname",uname);
		
		jQ("#alertevent-"+id).data("pnameid",pnameid);
		jQ("#alertevent-"+id).data("unameid",unameid);
		jQ("#alertevent-"+id).data("isself",isself);
		jQ("#alertevent-"+id).data("isuserself",true);
		jQ("#alertevent-"+id).data("isshareaccept",isshareaccept);
		jQ("#alertevent-"+id).data("isinviteaccept",isinviteaccept);
		jQ("#alertevent-"+id).data("isinviteevent",isinviteevent);
		jQ("#alertevent-"+id).data("acceptshareid",acceptshareid);
		jQ("#alertevent-"+id).data("cliptype",cliptype);
		jQ("#alertevent-"+id).data("shareid",shareid);
		jQ("#alertevent-"+id).data("clocktime",clocktime);
		jQ("#alertevent-"+id).data("clipusertype",clipusertype);
		jQ("#alertevent-"+id).data("reliedclipusertype",reliedclipusertype);
		jQ("#alertevent-"+id).data("clipeventpic",clipeventpic);
		jQ("#alertevent-"+id).data("isshielded",isshielded);
	});
	jQ("li.dataline div.simple span.clipcheckbox").click(function(){
		jQ(this).toggleClass("clipcheckboxon");
	});
	jQ("li.dataline div.simple span.ocopen").click(function(){
		jQ(this).parent().hide();
		addDetailContent(jQ(this).parent().parent());
		jQ(this).parent().next().fadeIn();
	});
	if(length==loadmaxlength){
		jQ("#daydetailcontent li:last").addClass("lastline");
		
		jQ(window.document).bind("scroll",listenScroll);
	}
}

function addAlertBtnHtml(){
	var html="";
	html+="<a class='occlose'></a>";
	html+="<div class='btnzone'>";
	html+="<div class=\"setalert\">";
	html+="<span class=\"alerttxt setalertelement\">提醒时间：</span>";
	html+="<span class=\"alertspan setalertelement\">";
	html+="<input onfocus=\"jQ(this).blur();\" style=\"float: left;height: 13px;width: 90px;margin-right: 10px;\" class=\"input\">";
	html+="<div class=\"timebg hourbg\">";
	html+="<a onclick=\"hourminus(jQ(this).next());\" onmousedown=\"autohourminusdown(jQ(this).next());\" onmouseup=\"autohourminusup(jQ(this).next());\" class=\"minus\"></a>";
	html+="<input class=\"hminput\" onblur=\"hourinput(this);\" value=\"0\" maxlength=\"2\">";
	html+="<a onclick=\"hourplus(jQ(this).prev());\" onmousedown=\"autohourplusdown(jQ(this).prev());\" onmouseup=\"autohourplusup(jQ(this).prev());\" class=\"plus\"></a>";
	html+="</div>";
		html+="<span style=\"margin-right: 10px;\">时</span>";
	html+="<div class=\"timebg minbg\">";
	html+="<a onclick=\"minminus(jQ(this).next());\" onmousedown=\"autominminusdown(jQ(this).next());\" onmouseup=\"autominminusup(jQ(this).next());\"  class=\"minus\"></a>";
	html+="<input class=\"hminput\" onblur=\"mininput(this);\" value=\"0\" maxlength=\"2\">";
	html+="<a onclick=\"minplus(jQ(this).prev());\" onmousedown=\"autominplusdown(jQ(this).prev());\" onmouseup=\"autominplusup(jQ(this).prev());\" class=\"plus\"></a>";
	html+="</div>";
		html+="<span>分</span>";
			html+="<span class=\"methodchoose\">";
			html+="<a title=\"邮件通知\" class=\"emailonit\"></a>";
			if(eval(jQ("#var_hasmobile").val()))
					html+="<a onclick=\"changeMobileStatus(this);\" title=\"短信通知\" class=\"mobilemsg\"></a>";
			html+="</span>";
			html+="<span class=\"errorinfo\" >";
			html+="</span>";
			html+="<a class=\"setalertconfirm\"></a>";
			html+="<a class=\"setalertcancel\"></a>";
		html+="</span>";
	html+="</div>";
	return html;
}

function delEventNotice(event){
	var info="您确定要删除当前档期么？";
	var title="删除档期";
	
	var opt=jQ("#viewopt");
	opt.data("liid",event.data.liid);
	opt.bind("delEvent",delEvent);
	opt.data("function","delEvent");
	jQ("#viewopt_p").empty().append(info);
	jQ("#viewopt").dialog("option", "title", title);
	jQ("#viewopt").dialog("open");
	
}

function delEvent(){
	var liobj=jQ("#"+jQ("#viewopt").data("liid"));
	var eventid=eval(liobj.data("eventid"));
	
	jQ.ajax({
		type: "POST",
		url:"eventAjax!deleteEvent.action",
		data:{
			eventid:eventid
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj['result']){
					liobj.remove();
					if(jQ("#daydetailcontent li[class!='nodata']").length==0){
						var emptyhtml="";
						for(var i=0;i<5;i++){
							emptyhtml+="<li class=\"nodata\" >";
							emptyhtml+="<div class='simple'>";
							if(i==0){
								emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
							}
							emptyhtml+="</div>";
							emptyhtml+="</li>";
						}
						jQ("#daydetailcontent").append(emptyhtml);
					}
					jQ("#viewopt").dialog("close");
				}else{
					
				}
			}
		}
	});
	
}

function alertEvent(event){
	var liobj=jQ("#"+event.data.liid); 
	var clocktime=eval(liobj.data("clocktime"));
	if(clocktime>0){
		var ulobj=jQ(this).parent().parent().prevAll("ul.detaillist");
		var alertbtn=jQ(this);
		var eventid=eval(liobj.data("eventid"));
		jQ.ajax({
			type: "POST",
			url:"eventAjax!cancelClock.action",
			data:{
				eventid:eventid
			},
			success:function(data){
				if(data!=null){
					var dataObj=eval("("+data+")");//转换为json对象
					if(dataObj['result']){
						ulobj.find("li.alertline").remove();
						alertbtn.attr("title","设置提醒");
						liobj.data("clocktime",0);
					}else{
						
					}
				}
			}
		});
	}else{
		var setalertobj=jQ(this).parent().prev();
		setalertobj.children().show();
		setalertobj.find("a.setalertconfirm").unbind("click").bind("click",function(){
			var errzone=jQ(this).prev();
			var inputdate=jQ(this).prevAll("input.input");
			var alertdateval=inputdate.val();
			if(alertdateval==null||alertdateval.length<=0){
				errzone.empty();
				errzone.append("请选择提醒的时间。");
				errzone.show();
				return;
			}else{
				errzone.empty();
			}
			
			var alertdate=inputdate.datepicker( "getDate" );
			var alerthourobj=jQ(this).prevAll("div.hourbg").find("input.hminput");
			var alertminobj=jQ(this).prevAll("div.minbg").find("input.hminput");
			var alerthour=eval(alerthourobj.val());
			var alertmin=eval(alertminobj.val());
			alertdate.setHours(alerthour);
			alertdate.setMinutes(alertmin);
			var alertlong=alertdate.getTime();
			var nowdate=new Date();
			if(alertlong<nowdate){
				errzone.empty();
				errzone.append("提醒的时间应该是将来的时间。");
				errzone.show();
				return;
			}else{
				errzone.empty();
			}
			var mobilenotice=0;
			var isChecked=eval(jQ(this).prevAll("span.methodchoose").find("a.mobilemsg").attr("mobilenotice"));
			if(isChecked&&eval(jQ("#var_hasmobile"))){
				mobilenotice=1;
			}
			var eventid=eval(liobj.data("eventid"));
			jQ.ajax({
				type: "POST",
				url:"eventAjax!addEventClock.action",
				data:{
					eventid:eventid,
					alerttime:alertlong,
					mobilenotice:mobilenotice
				},
				success:function(data){
					
					if(data!=null){
						var dataObj=eval("("+data+")");//转换为json对象
						if(dataObj.result){
							var temphtml="";
							temphtml+="<li class='alertline'>";
							temphtml+="<span class=\"title\">档期提醒：</span>";
							temphtml+="<span><b>"+formateDetailTime(alertlong)+"</b></span>";
							temphtml+="</li>";
							liobj.find("div.detail>ul.detaillist").find("li:last").after(temphtml);
							setalertobj.children().hide();
							inputdate.val("");
							alerthourobj.val("");
							alertminobj.val("");
							liobj.data("clocktime",alertlong);
						}else{
						}
					}
				}
			});
		});
		setalertobj.find("a.setalertcancel").unbind("click").bind("click",function(){
			setalertobj.children().hide();
		});
		
	}
	
}

function addDetailContent(liobj){
	var detailobjtype=liobj.attr("id").split("-")[0];
	if(detailobjtype=='memoevent'){
		var eventid=jQ(liobj).data("eventid");
		var title=jQ(liobj).data("title");
		var unamelogo=jQ(liobj).data("unamelogo");
		var unameid=jQ(liobj).data("unameid");
		var uname=jQ(liobj).data("uname");
		var clocktime=jQ(liobj).data("clocktime");
		var starttime=jQ(liobj).data("starttime");
		var html="";
		html+="<ul class=\"detaillist\">";
		html+="	<li class='firstline'>";
		html+="<a class=\"userlogo\">";
		html+="<img src=\""+unamelogo+"\" width=\"60\"></img>";
		html+="</a>";
		html+="<div class=\"infoandtitle\">";
		html+="<div class=\"info\">";
		html+="<span class=\"name\">";
			html+=uname;
		html+="</span>";
		html+="</div>";
		html+="<div class='title'>";
		html+="<span class=\"title\">日期：</span>";
		html+="<span ><b>"+formateMemoDate(starttime)+"</b></span>";
		html+="</div>";
		html+="</div>";
		html+="</li>";
		html+="<li class='secondline'>";
		html+="<div class='cliptime'>";
		html+="<span class=\"title\">内容：</span>";
		html+="<span style=\"width: 200px;\" >"+title+"</span>";
		html+="</div>";
		html+="</li>";
		if(clocktime>0){
			html+="<li class='alertline'>";
			html+="<span class=\"title\">档期提醒：</span>";
			html+="<span><b>"+formateDetailTime(clocktime)+"</b></span>";
			html+="</li>";
		}
		html+="</ul>";
		html+=jQ("#calendarzoneout").clone().html();
		html+=addAlertBtnHtml();
		html+="<div class='btn'>";
		html+="<span class='del'></span>";
		if(clocktime>0)
			html+="<span class='alert' title='取消提醒'></span>";
		else
			html+="<span class='alert' title='设置提醒'></span>";
		html+="</div>";
		html+="</div>";
		liobj.find("div.detail").empty().append(html);
		liobj.find("input.input").datepicker({
			yearRange : '1950:2020',
			dateFormat:'yy-mm-dd',
			changeMonth:true,
			changeYear:true,
			beforeShow: function(i,e){  
				var z = jQuery(i).closest(".ui-dialog").css("z-index") + 4;  
				e.dpDiv.css('z-index', z);
				e.dpDiv.css('font', "14px \"Trebuchet MS\", sans-serif");
			}
		});
		liobj.find("a.occlose").click(function(){
			jQ(this).parent().hide();
			jQ(this).parent().prev().fadeIn();
			jQ(this).parent().children().remove();
		});
		liobj.find("div.btn>span.del").unbind("click").bind("click",{liid:liobj.attr("id")},delEventNotice);
		liobj.find("div.btn>span.alert").unbind("click").bind("click",{liid:liobj.attr("id")},alertEvent);
		initDetailTimeCalendar(starttime,1,null,liobj.find("div.detail").find("div.calendarzone"));
		return;
	}
	var eventid=jQ(liobj).data("eventid");
	var cliptype=eval(jQ(liobj).data("cliptype"));
	var eventtype=eval(jQ(liobj).data("eventtype"));
	var seid=eval(jQ(liobj).data("seid"));
	var reliedclip=eval(jQ(liobj).data("reliedclip"));
	if(cliptype==3){
		var url="";
		if(eventtype==2&&(seid==0||seid==reliedclip)){
			url="eventAjax!getShareCount.action";
		}else{
			url="eventAjax!getInviteCount.action";
		}
		jQ.ajax({
			type: "POST",
			url:url,
			data:{
				eventid:eventid
			},
			success:function(data){
				
				if(data!=null){
					var dataObj=data;//转换为json对象
					_in_addDetailContent(liobj,dataObj);
				}
			}
		});
	}else{
		if(cliptype==4){
			jQ.ajax({
				type: "POST",
				url:"eventAjax!getRequestCount.action",
				data:{
					eventid:eventid
				},
				success:function(data){
					
					if(data!=null){
						var dataObj=data;//转换为json对象
						_in_addDetailContent(liobj,dataObj);
					}
				}
			});
		}else
			_in_addDetailContent(liobj,null);
	}
	
	
	//liobj.find("div.btn>a.ignoreinvite").unbind("click").bind("click",{liid:liobj.attr("id")},ignoreinviteEvent);
}

function _in_addDetailContent(liobj,jsonobj){
	
	var id=liobj.attr("id");
	var eventid=jQ(liobj).data("eventid");
	var isself=jQ(liobj).data("isself");
	var isuserself=eval(jQ(liobj).data("isuserself"));
	var uname=jQ(liobj).data("uname");
	var unameid=jQ(liobj).data("unameid");
	var unamelogo=jQ(liobj).data("unamelogo");
	var unameslogo=jQ(liobj).data("unameslogo");
	var reliedclip=eval(jQ(liobj).data("reliedclip"));
	var cliptype=eval(jQ(liobj).data("cliptype"));
	var seid=eval(jQ(liobj).data("seid"));
	var shareid=jQ(liobj).data("shareid");
	var title=jQ(liobj).data("title");
	var starttime=jQ(liobj).data("starttime");
	var endtime=jQ(liobj).data("endtime");
	var iswholeday=jQ(liobj).data("iswholeday");
	var content=jQ(liobj).data("content");
	var clocktime=jQ(liobj).data("clocktime");
	var clipstatus=jQ(liobj).data("clipstatus");
	var eventtype=eval(jQ(liobj).data("eventtype"));
	var timesituation=jQ(liobj).data("timesituation");
	var processstatus=jQ(liobj).data("processstatus");
	var isconfirmevent=jQ(liobj).data("isconfirmevent");
	var eventisinterested=jQ(liobj).data("eventisinterested");
	var clipeventpic=jQ(liobj).data("clipeventpic");
	var isshielded=jQ(liobj).data("isshielded");
	var clipiscc=eval(jQ(liobj).data("clipiscc"));
	var invitetime=jQ(liobj).data("invitetime");
	
	var usertype=eval(jQ("#var_usertype").val());
	var currentusertype=eval(jQ("#var_usertype").val());
	
	var hasinvitetime=false;
	if(eventtype==2&&typeof(invitetime)!='undefined'&&eval(invitetime)>0){
		hasinvitetime=true;
		invitetime=eval(invitetime);
	}
	
	if(jsonobj!=null)
		jQ(liobj).data("commentcount",jsonobj.commentcount);
	var html="";
	
	html+="<ul class=\"detaillist\">";
	html+="<li class=\"firstline\" >";
		html+="<a class=\"userlogo\" href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+unameid+"\">";
		html+="<img src=\""+unamelogo+"\" width=\"60\"></img>";
		html+="</a>";
		html+="<div class=\"infoandtitle\">";
		html+="<div class=\"info\">";
		html+="<span class=\"name\">";
			html+=uname;
		html+="</span>";
		if(clipiscc||(currentusertype==2&&isuserself))
			html+="<span class=\"v_icon\" title=\"档期认证\"></span>";
		if(cliptype==3){
			if(eventtype==2&&(seid==0||seid==reliedclip)){
				
			}else{
				html+="<span class=\"source_l\">";
					html+="<i class=\"invite\"></i>";
				html+="</span>";
			}
		}else if(cliptype==4){
			html+="<span class=\"source_l\">";
				html+="<i class=\"request\"></i>";
			html+="</span>";
		}
		if(eventtype==2&&seid>0){
			if(reliedclip!=seid){
				var sourceeventid=jQ(liobj).data("sourceeventid");
				var sourceuid=jQ(liobj).data("sourceuid");
				var sourceuname=jQ(liobj).data("sourceuname");
				var sourceulogo=jQ(liobj).data("sourceulogo");
				html+="<span class=\"source_r\">";
				html+="<span class=\"sourcetitle\">内容来源：</span>";
				html+="<i class=\"sourcelogo\" style=\"background:url('"+sourceulogo+"')\" title=\""+sourceuname+"\"></i>";
				html+="<span class=\"v_icon\" title=\"档期认证\"></span>";
				html+="</span>";
			}
		}
		html+="</div>";
		html+="<div class=\"cliptime\">";
		if(hasinvitetime){
			html+="<span class=\"title\" style='color:#EF3965;'>邀请时间：</span>";
			html+="<span ><b style='color:#EF3965;'>"+formateClockTime(invitetime)+"</b>";
		}else{
			
			html+="<span class=\"title\">活动日期：</span>";
			if(iswholeday){
				if(eventtype==2||cliptype==1)
					html+="<span><b> 开始于 </b><b>"+formateClockTime(starttime)+"</b>";
				else
					html+="<span><b> 开始于 </b><b>"+formateDetailTime(starttime)+"</b>";
			}else{
				if(eventtype==2||cliptype==1)
					html+="<span><b>"+formateClockTime(starttime)+"</b><b> - </b><b>"+formateClockTime(endtime)+"</b>";
				else
					html+="<span><b>"+formateDetailTime(starttime)+"</b><b> - </b><b>"+formateDetailTime(endtime)+"</b>";
			}
		}
		html+="</div>";
		

		html+="</div>";
		html+="</li>";//第一行结束
		if(hasinvitetime){
			html+="<li class=\"secondline\">";
			html+="<div class=\"title\">";
			html+="<span class=\"title\">活动日期：</span>";
			if(iswholeday){
				if(eventtype==2||cliptype==1)
					html+="<span><b> 开始于 </b><b>"+formateClockTime(starttime)+"</b>";
				else
					html+="<span><b> 开始于 </b><b>"+formateDetailTime(starttime)+"</b>";
			}else{
				if(eventtype==2||cliptype==1)
					html+="<span><b>"+formateClockTime(starttime)+"</b><b> - </b><b>"+formateClockTime(endtime)+"</b>";
				else
					html+="<span><b>"+formateDetailTime(starttime)+"</b><b> - </b><b>"+formateDetailTime(endtime)+"</b>";
			}
			html+="</div>";	
			html+="</li>";
		}
		html+="<li class=\"secondline\">";
			html+="<div class=\"title\">";
				html+="<span class=\"title\">内容：</span>";
				html+="<span style=\"float: left;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:280px;\">"+title+"</span>";
				if((reliedclip>0||isuserself==false)&&shareid.length>0){
					html+="<a class=\"opt\" href='"+jQ("#ctxVal").val()+"/myclip/clip_detail.html?"+shareid+"' >查看详细</a>";
				}else
					html+="<a class=\"opt\" href='"+jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid+"' >查看详细</a>";
			html+="</div>";	
		html+="</li>";
		if((content!=null&&content.length>0)||clipeventpic.length>0){
			html+="<li class='detail' style='height:auto;'>";
				html+="<div class=\"detailcontent\">";
					html+="<span class=\"title\">详情：</span>";
					if(content!=null&&content.length>0)
						html+="<p>"+content+"</p>";
				html+="</div>";
				if(clipeventpic.length>0){
					html+="<div class=\"clippic bigcursor\">";
						html+="<img class='bigcursor' onload='resizeImgCSS(this)' style='display:none;' src='"+jQ("#ctxVal").val()+"/clippic/S_"+clipeventpic+"'>";
					html+="</div>";
				}
			html+="</li>";
		}
		
		
		var userhtml="";
		if(cliptype==3){
			if(eventtype==2&&(seid==0||seid==reliedclip)){
				if(usertype!=2){
					var userlist=jsonobj.users;
					userhtml+="<li class=\"last\">";
					userhtml+="<div class=\"top\">";
					userhtml+="</div>";
					userhtml+="<div class=\"arrow_box\">";
					if(typeof(userlist)=='undefined'||userlist.length==0){
						userhtml+="<span class=\"info\">";
						userhtml+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您是否想转给你的好友们看看那？";
						userhtml+="</span>";
					}else{
						userhtml+="<span class=\"info\">";
						userhtml+="感兴趣的好友：";
						userhtml+="</span>";
						userhtml+="<ul style=\"float: left;\">";
						var interestedcount=0;
						for(var i=0;i<userlist.length;i++){
							var userobj=userlist[i];
							var uid=userobj.uid;
							var name=userobj.name;
							var smalllogo=userobj.smalllogo;
							var biglogo=userobj.biglogo;
							userhtml+="<li class=\"iton\" title='"+name+"'>";
							userhtml+="<input type='hidden' class='logo' value=\""+biglogo+"\">";
							userhtml+="<input type='hidden' class='uid' value=\""+uid+"\">";
							userhtml+="<input type='hidden' class='name' value=\""+uid+"\">";
							userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"\" style=\"background:url('"+smalllogo+"')\"></a>";
							userhtml+="</li>";
						}
						userhtml+="</ul>";
					}
					userhtml+="<div class=\"btnline\">";
					userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
					userhtml+="</div>";
					userhtml+="</div>";
					userhtml+="</li>";
				}
			}else{
				var userlist=jsonobj.users;
				userhtml+="<li class=\"last\">";
				userhtml+="<div class=\"top\">";
				if(isconfirmevent)
					userhtml+="<img src=\""+jQ("#ctxVal").val()+"/image/confirmevent_status.png\" >";
				userhtml+="</div>";
				userhtml+="<div class=\"arrow_box\">";
				userhtml+="<span class=\"info\">";
				if(isconfirmevent)
					userhtml+="参与的好友：";
				else
					userhtml+="邀请的好友：";
				userhtml+="</span>";
				userhtml+="<ul style=\"float: left;\">";
				//加入自己的状态和头像-----------------------------
				if(isuserself==false||reliedclip>0){
					if(eventisinterested){
						userhtml+="<li class=\"iton\" title='我'>";
					}else{
						userhtml+="<li title='我'>";
					}
					userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+jQ("#var_usertype").data("uid")+"\" style=\"background:url('"+jQ("#var_usertype").data("smallurl")+"')\"></a>";
					userhtml+="</li>";
				}
//				userhtml+="<li class=\"iton\" title='感兴趣的好友："+name+"'>";
				//加入自己的状态和头像-----------------------------
				var interestedcount=0;
				for(var i=0;i<userlist.length;i++){
					var userobj=userlist[i];
					var uid=userobj.uid;
					var name=userobj.name;
					var smalllogo=userobj.smalllogo;
					var biglogo=userobj.biglogo;
					var tmpeventisinterested=userobj.eventisinterested;
					if(tmpeventisinterested){
						interestedcount++;
						if(isconfirmevent)
							userhtml+="<li class=\"iton\" title='"+name+"'>";
						else
							userhtml+="<li class=\"iton\" title='感兴趣的好友："+name+"'>";
					}else{
						if(isconfirmevent)
							userhtml+="<li title='退出活动的好友："+name+"'>";
						else
							userhtml+="<li title='"+name+"'>";
					}
					userhtml+="<input type='hidden' class='logo' value=\""+biglogo+"\">";
					userhtml+="<input type='hidden' class='uid' value=\""+uid+"\">";
					userhtml+="<input type='hidden' class='name' value=\""+name+"\">";
					userhtml+="<a href=\""+jQ("#ctxVal").val()+"/myclip/user.html?"+uid+"\" style=\"background:url('"+smalllogo+"')\"></a>";
					userhtml+="</li>";
				}
				if(!isconfirmevent){
					//if(processstatus==0||processstatus==-1){
						if(reliedclip==0&&isuserself){
							userhtml+="<li class=\"addbtn\">";
							userhtml+="<a onclick='showContactDetailTip(this,"+eventid+");'></a>";
							userhtml+="<span class=\"tip\">继续添加好友，一起同行？</span>";
							userhtml+="</li>";
						}
					//}
				}
				userhtml+="</ul>";
				if(!isconfirmevent){
					//if(processstatus==0||processstatus==-1){
							
						userhtml+="<div class=\"btnline\">";
						if(reliedclip==0&&isuserself){
							if(interestedcount>0)
								userhtml+="<button class=\"confirmevent\" onclick=\"showConfirmEvent(this,'"+id+"');\"></button>";
						}else
							userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
						userhtml+="</div>";
					//}
				}else{
					//if(processstatus==0||processstatus==-1)
						if(reliedclip>0||!isuserself){
							userhtml+="<div class=\"btnline\">";
							userhtml+="<button class=\"forward\" onclick=\"showForwardEvent(this,'"+id+"');\"></button>";
							userhtml+="</div>";
						}
				}
				userhtml+="</div>";
				userhtml+="</li>";
			}
		}
		html+=userhtml;
		html+="</ul>";
		html+=jQ("#calendarzoneout").clone().html();
		html+="<a class=\"occlose\"></a>";
		
		html+="<div class=\"btnzone\">";
			if(cliptype==1){
				html+="<div class=\"line\">";
				html+="<a class=\"del\">取消档期</a>";
//				if(isinviteevent){
//					var commentcount=jsonobj.commentcount;
//					html+="<a class=\"comment\" title=\""+commentcount+"\">评论("+commentcount>99999?"99999+":commentcount+")</a>";
//				}
				if(clocktime>0){
					html+="<div class=\"setclock\">";
					html+="<div class=\"middle\">";
					html+="<i class=\"clock\"></i>";
					html+="<span class=\"timedata\">"+formateClockTime(clocktime)+"</span>";
					html+="<a class=\"cancel\"></a>";
					html+="</div>";
					html+="</div>";
				}else{
					html+="<div class=\"setclock\">";
					html+="<div class=\"middle\">";
					html+="<i class=\"clockoff\"></i>";
					html+="<a class=\"timeset\">设置提醒</a>";
					html+="</div>";
					html+="</div>";
				}
				html+="</div>";
//				if(isinviteevent){
//					html+="<div class=\"line\">";
//					html+="<input type=\"text\">";
//					html+="<button class=\"commentbtn\"></button>";
//					html+="</div>";
//				}
			}else if(cliptype==3){
				if(eventtype==2&&seid==0&&isuserself){
					var commentcount=jsonobj.commentcount;
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					html+="<a class=\"del\">取消档期</a>";
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
					html+="</div>";
				}else if(eventtype==2&&(seid==0||reliedclip==seid)){
					var isinterest=jsonobj.isinterest;
					var isforward=jsonobj.isforward;
					var isfavor=jsonobj.isfavor;
					var interestcount=jsonobj.interestcount;
					var forwardcount=jsonobj.forwardcount;
					var favorcount=jsonobj.favorcount;
					var commentcount=jsonobj.commentcount;
					liobj.data("eventisinterested",isinterest);
					liobj.data("isforward",isforward);
					liobj.data("isfavor",isfavor);
					liobj.data("interestcount",interestcount);
					liobj.data("forwardcount",forwardcount);
					liobj.data("favorcount",favorcount);
					liobj.data("commentcount",commentcount);
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					html+=getInterestBtnHTML(isinterest,interestcount);
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					html+=getFavorBtnHTML(isfavor,favorcount);
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
					html+="</div>";
				}else{
					var commentcount=jsonobj.commentcount;
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					html+="<div class=\"line\">";
					if(isuserself&&reliedclip==0){
						html+="<a class=\"del\">取消档期</a>";
					}else{
						if(isconfirmevent){
							html+="<a class='quitclip' title='退出活动'>退出活动</a>";
						}else{
							if(isshielded==false){
								html+=getInterestBtnHTML(eventisinterested,null);
							}
						}
					}
					if(isuserself||isshielded==false)
						html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
					if(eventisinterested||(isuserself&&reliedclip==0)){
						if(clocktime>0){
							html+="<div class=\"setclock\">";
							html+="<div class=\"middle\">";
							html+="<i class=\"clock\"></i>";
							html+="<span class=\"timedata\">"+formateClockTime(clocktime)+"</span>";
							html+="<a class=\"cancel\"></a>";
							html+="</div>";
							html+="</div>";
						}else{
							html+="<div class=\"setclock\">";
							html+="<div class=\"middle\">";
							html+="<i class=\"clockoff\"></i>";
							html+="<a class=\"timeset\">设置提醒</a>";
							html+="</div>";
							html+="</div>";
						}
					}
					
					if(isshielded){
						html+="<a class='msgclose' title='接收该档期的提示'>接收提示</a>";
					}else{
						if(isuserself&&reliedclip==0){
						}else{
							if(isconfirmevent){
							}else{
								if(eventisinterested==false)
									html+="<a class='msgopen' title='不再接收该档期的提示'>不再提示</a>";
							}
						}
					}
					html+="</div>";
					html+="<div class=\"line commentline\">";
					html+="<input type=\"text\">";
					html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
					html+="</div>";
				}
			}else if(cliptype==4){
				var commentcount=jsonobj.commentcount;
				var commentcountstr=commentcount>99999?"99999+":""+commentcount;
				html+="<div class=\"line\">";
				if(isuserself){
					html+="<a class=\"del\" title=\"删除该档期\">取消档期</a>";
				}else{
					html+="<a class=\"atta\" title=\"邀请TA一起参与活动\">邀请TA</a>";
				}
				html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论' count='"+commentcount+"'>评论("+commentcountstr+")</a>";
				html+="</div>";
				html+="<div class=\"line commentline\">";
				html+="<input type=\"text\">";
				html+="<button class=\"commentbtn\" onclick='addNewComment(this);'></button>";
				html+="</div>";
			}
			
		html+="</div>";
		liobj.children("div.detail").empty().append(html);
		initDetailTimeCalendar(starttime,iswholeday,endtime,liobj.find("div.detail").find("div.calendarzone"));
		liobj.find("a.occlose").click(function(){
			jQ(this).parent().hide();
			jQ(this).parent().prev().fadeIn();
		});
		liobj.find("div.btnzone div.setclock").find("div.middle a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
		liobj.find("div.btnzone div.setclock").find("div.middle a.cancel").unbind("click").bind("click",{liid:liobj.attr("id")},cancelClockevent);
//		liobj.find("div.btnzone div.detail").find("ul.detaillist li.last").find("").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
		liobj.find("div.btnzone a.del").unbind("click").bind("click",{liid:liobj.attr("id")},delEventNotice);
		liobj.find("div.btnzone a.interest").unbind("click").bind("click",{liid:liobj.attr("id")},uninterestClipevent);
		liobj.find("div.btnzone a.uninterest").unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
		liobj.find("div.btnzone a.comment").unbind("click").bind("click",{liid:liobj.attr("id")},showCommentEvent);
		liobj.find("div.btnzone a.quitclip").unbind("click").bind("click",{liid:liobj.attr("id")},quickClipevent);
		liobj.find("div.btnzone a.msgopen").unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
		liobj.find("div.btnzone a.msgclose").unbind("click").bind("click",{liid:liobj.attr("id")},acceptClipmessage);
		liobj.find("div.btnzone a.unfavor").unbind("click").bind("click",{liid:liobj.attr("id")},favorClipevent);
		liobj.find("div.btnzone a.favor").unbind("click").bind("click",{liid:liobj.attr("id")},unfavorClipevent);
		liobj.find("div.btnzone a.atta").unbind("click").bind("click",{liid:liobj.attr("id")},inviteTAClipevent);
		liobj.find("ul.detaillist li.detail").find("div.clippic").unbind("click").bind("click",{liid:liobj.attr("id")},showClipeventpic);
}

function inviteTAClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var unameid=eval(liobj.data("unameid"));
	var date=eval(jQ("#datedetailzone").data("date"));
	var month=eval(jQ("#datedetailzone").data("month"));
	var year=eval(jQ("#datedetailzone").data("year"));
	window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?year="+year+"&month="+(month+1)+"&day="+date+"&invites="+unameid;
}

function favorClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var seid=eval(liobj.data("seid"));
	if(seid>0){
		dealeventid=seid;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"shareAjax!favorShareEvent.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					var favorcount=liobj.data("favorcount");
					favorcount++;
					liobj.data("favorcount",favorcount);
					var favorcountstr=favorcount>99999?"99999+":""+favorcount;
					btnobj.text("取消喜欢("+favorcountstr+")");
					btnobj.removeClass().addClass("favor").attr("title","取消喜欢该档期");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},unfavorClipevent);
				}else{
					alert(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}

function unfavorClipevent(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var seid=eval(liobj.data("seid"));
	if(seid>0){
		dealeventid=seid;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"shareAjax!unfavorShareEvent.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					var favorcount=liobj.data("favorcount");
					favorcount--;
					liobj.data("favorcount",favorcount);
					var favorcountstr=favorcount>99999?"99999+":""+favorcount;
					btnobj.text("喜欢("+favorcountstr+")");
					btnobj.removeClass().addClass("unfavor").attr("title","喜欢该档期");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},favorClipevent);
				}else{
					alert(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}

function shieldClipmessage(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var reliedclip=eval(liobj.data("reliedclip"));
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!shieldClipmessage.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data.result){
				btnobj.prevAll().hide();
				liobj.data("isshielded",1);
				btnobj.removeClass().addClass("msgclose").attr("title","接收该档期的提示");
				btnobj.text("接收提示");
				btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},acceptClipmessage);
			}else{
				
			}
		}
	});
}

function acceptClipmessage(event){
	var btnobj=jQ(event.currentTarget);
	var liobj=jQ("#"+event.data.liid);
	var dealeventid=0;
	var reliedclip=eval(liobj.data("reliedclip"));
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!acceptClipmessage.action",
		data:{
			eventid:eval(dealeventid)
		},
		success:function(data){
			if(data.result){
				if(btnobj.prevAll("a").length<=0){
					var commentcount=eval(liobj.data("commentcount"));
					var commentcountstr=commentcount>99999?"99999+":""+commentcount;
					var html="";
					html+="<a class='uninterest' title='表示对该档期的感兴趣'>感兴趣</a>";
					html+="<a style='margin-left: 10px;' class='comment' title='添加对该档期的评论'>评论("+commentcountstr+")</a>";
					btnobj.before(html);
					btnobj.parent().find("a.uninterest").unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
					btnobj.parent().find("a.comment").unbind("click").bind("click",{liid:liobj.attr("id")},showCommentEvent);
				}else
					btnobj.prevAll().show();
				liobj.data("isshielded",0);
				btnobj.removeClass().addClass("msgopen").attr("title","不再接收该档期的提示");
				btnobj.text("不再提示");
				btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
			}else{
				
			}
		}
	});
}

function quickClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	jQ.ajax({
		type: "POST",
		url:"shareAjax!quitClip.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					clip_tips("成功退出活动");
					var ulobj=liobj.parent();
					liobj.remove();
					if(ulobj.find("li[class!='nodata']").length==0){
						var html="<li class=\"nodata\"><div class=\"simple\"><span class=\"emptytxt\">暂无内容</span></div></li>";
						html+="<li class=\"nodata\"><div class=\"simple\"></div></li>";
						html+="<li class=\"nodata\"><div class=\"simple\"></div></li>";
						html+="<li class=\"nodata\"><div class=\"simple\"></div></li>";
						html+="<li class=\"nodata\"><div class=\"simple\"></div></li>";
						ulobj.append(html);
					}
				}else{
					
				}
			}
		}
	});
}

function showClipeventpic(event){
	var liobj=jQ("#"+event.data.liid);
	var clipeventpic=liobj.data("clipeventpic");
	var target=jQ(event.currentTarget);
	if(target.hasClass("bigcursor")){
		//放大
		target.removeClass("bigcursor").addClass("smallcursor");
		target.find("img").removeClass().addClass("smallcursor");
		target.find("img").hide();
		target.find("img").attr("src",jQ("#ctxVal").val()+"/clippic/"+clipeventpic);
	}else{
		//缩小
		target.removeClass("smallcursor").addClass("bigcursor");
		target.find("img").removeClass().addClass("bigcursor");
		target.find("img").hide();
		target.find("img").attr("src",jQ("#ctxVal").val()+"/clippic/S_"+clipeventpic);
	}
	
}

function setclockClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	jQ(this).prev().removeClass().addClass("clock");
	jQ(this).hide();
	var html="";
	html+="<input class=\"date\"/>";
	html+="<input class=\"time hour\" value=\"0\"/>";
	html+="<span class=\"time\">时</span>";
	html+="<input class=\"time min\" value=\"0\"/>";
	html+="<span class=\"time\">分</span>";
	html+="<a class=\"confirm\"></a>";
	html+="<a class=\"cancel\"></a>";
	jQ(this).after(html);
	jQ(this).nextAll("input.date").data("liid",event.data.liid);
	jQ(this).nextAll("input.date").datepicker({
		yearRange : '1950:2020',
		dateFormat:'yy-mm-dd',
		changeMonth:true,
		changeYear:true,
		beforeShow: function(i,e){  
		var z = jQuery(i).closest(".ui-dialog").css("z-index") + 4;  
		e.dpDiv.css('z-index', z);  
		e.dpDiv.css('font', "14px \"Trebuchet MS\", sans-serif");
		}
    });
	jQ(this).nextAll("input.hour").unbind("blur").bind("blur",hourinput);
	jQ(this).nextAll("input.min").unbind("blur").bind("blur",mininput);
	jQ(this).nextAll("a.cancel").unbind("click").bind("click",function(){
		var clockobj=jQ(this).prevAll("i.clock");
		clockobj.removeClass("clock").addClass("clockoff");
		clockobj.nextAll().remove();
		clockobj.after("<a class=\"timeset\">设置提醒</a>");
		clockobj.nextAll("a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
		
	});
	jQ(this).nextAll("a.confirm").unbind("click").bind("click",function(){
		var alertdate=jQ(this).prevAll("input.date").datepicker( "getDate" );
		if(alertdate==null||alertdate.length<=0){
			clip_tips("请选择提醒日期。");
			return false;
		}
		var alerthour=eval(jQ("input.hour").val());
		var alertmin=eval(jQ("input.min").val());
		alertdate.setHours(alerthour);
		alertdate.setMinutes(alertmin);
		var alertlong=alertdate.getTime();
		var nowdate=new Date();
		if(alertlong<nowdate){
			clip_tips("提醒的时间应该是将来的时间。");
			return false;
		}
		var clockobj=jQ(this).prevAll("i.clock");
		var liid=jQ(this).prevAll("input.date").data("liid");
		var eventid=jQ("#"+liid).data("eventid");
		jQ.ajax({
			type: "POST",
			url:"eventAjax!addEventClock.action",
			data:{
				eventid:eval(eventid),
				alerttime:alertlong,
				mobilenotice:0
			},
			success:function(data){
				if(data!=null){
					var dataObj=eval("("+data+")");//转换为json对象
					if(dataObj.result){
						var temphtml="";
						temphtml+="<span class=\"timedata\">"+formateClockTime(alertlong)+"</span>";
						temphtml+="<a class=\"cancel\"></a>";
						clockobj.nextAll().remove();
						clockobj.after(temphtml);
						clockobj.nextAll("a.cancel").unbind("click").bind("click",{liid:liid},cancelClockevent);
					}else{
						
					}
				}
			}
		});
	});
	jQ(this).remove();
}

function cancelClockevent(event){
	var liid=event.data.liid;
	var liobj=jQ("#"+liid);
	var eventid=jQ("#"+liid).data("eventid");
	var clockobj=jQ(event.currentTarget).prevAll("i.clock");
	jQ.ajax({
		type: "POST",
		url:"eventAjax!cancelClock.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data.result){
				var temphtml="";
				temphtml+="<a class=\"timeset\">设置提醒</a>";
				clockobj.nextAll().remove();
				clockobj.after(temphtml);
				clockobj.removeClass("clock").addClass("clockoff");
				clockobj.next().unbind("click").bind("click",{liid:liid},setclockClipevent);
			}else{
				
			}
		}
	});
}

function showForwardEvent(obj,liid){
	var btnline=jQ(obj).parent();
	if(btnline.nextAll("div.zonecontent").length>0){
		if(btnline.nextAll("div.zonecontent").css("display")=="none"){
			btnline.nextAll("div.zonecontent").show();
		}else{
			btnline.nextAll("div.zonecontent").hide();
		}
		
	}else{
		btnline.after(jQ("#forwardsharepart").clone().html());
		btnline.nextAll("div.zonecontent").attr("id","zone_"+liid);
	}
	
}

function showConfirmEvent(obj,liid){
	var btnobj=jQ(obj);
	var ulobj=btnobj.parent().prevAll("ul");
	var itonlist=ulobj.find("li.iton");
	if(itonlist.length<=0){
		clip_tips("暂时还未任何好友表态感兴趣，不能进行一拍即合操作。");
	}else{
		jQ("#inf_interestlist").empty();
		var html="";
		jQ("#inf_interestlist").data("itonlength",itonlist.length);
		if(itonlist.length>15){
			var pagecount=Math.ceil(itonlist.length/15);
			jQ("#inf_interestlist").data("pagecount",pagecount);
			jQ("#inf_interestlist").data("currentpage",0);
			for(var i=0;i<15;i++){
				var logo=jQ(itonlist[i]).find("input.logo").val();
				var uid=jQ(itonlist[i]).find("input.uid").val();
				var name=jQ(itonlist[i]).find("input.name").val();
				html+="<li title=\""+name+"\">";
				html+="<img src=\""+logo+"\"/>"
				html+="</li>";
			}
			jQ("#inf_interest_next").show();
			jQ("#inf_interest_next").unbind("click").bind("click",function(){
				var currentpage=eval(jQ("#inf_interestlist").data("currentpage"));
				var pagecount=eval(jQ("#inf_interestlist").data("pagecount"));
				var itonlength=eval(jQ("#inf_interestlist").data("itonlength"));
				if(currentpage+1>=pagecount){
					jQ(this).hide();
					return;
				}else{
					if(currentpage==0)
						jQ("#inf_interest_prev").show();
					currentpage++;
					var html="";
					for(var i=0;i<15;i++){
						var index=i+15*currentpage;
						if(index==itonlength)
							break;
						var logo=jQ(itonlist[i]).find("input.logo").val();
						var uid=jQ(itonlist[i]).find("input.uid").val();
						var name=jQ(itonlist[i]).find("input.name").val();
						html+="<li title=\""+name+"\">";
						html+="<img src=\""+logo+"\"/>"
						html+="</li>";
					}
					jQ("#inf_interestlist").data("currentpage",currentpage);
					jQ("#inf_interestlist").empty().append(html);
					if(currentpage==pagecount-1){
						jQ(this).hide();
					}
				}
			});
			jQ("#inf_interest_prev").unbind("click").bind("click",function(){
				var currentpage=eval(jQ("#inf_interestlist").data("currentpage"));
				var pagecount=eval(jQ("#inf_interestlist").data("pagecount"));
				var itonlength=eval(jQ("#inf_interestlist").data("itonlength"));
				if(currentpage-1<0){
					jQ(this).hide();
					return;
				}else{
					if(currentpage+1==pagecount)
						jQ("#inf_interest_next").show();
					currentpage--;
					var html="";
					for(var i=0;i<15;i++){
						var index=i+15*currentpage;
						if(index==itonlength)
							break;
						var logo=jQ(itonlist[i]).find("input.logo").val();
						var uid=jQ(itonlist[i]).find("input.uid").val();
						var name=jQ(itonlist[i]).find("input.name").val();
						html+="<li title=\""+name+"\">";
						html+="<img src=\""+logo+"\"/>"
						html+="</li>";
					}
					jQ("#inf_interestlist").data("currentpage",currentpage);
					jQ("#inf_interestlist").empty().append(html);
					if(currentpage==0){
						jQ(this).hide();
					}
						
						
				}
			});
		}else{
			itonlist.each(function(){
				var logo=jQ(this).find("input.logo").val();
				var uid=jQ(this).find("input.uid").val();
				var name=jQ(this).find("input.name").val();
				html+="<li title=\""+name+"\">";
				html+="<img src=\""+logo+"\"/>"
				html+="</li>";
			});
		}
		
		jQ("#inf_interestlist").append(html);
		var btnoffset=btnobj.offset();
		jQ("#confirmEventInterface").css({"top":btnoffset.top-200,"left":btnoffset.left-360});
		jQ("#inf_interest_confirm").data("eventid",jQ("#"+liid).data("eventid"));
		jQ("#inf_interest_confirm").data("liid",liid);
		jQ("#inf_interest_confirm").unbind("click").bind("click",confirmEventOpt);
		jQ("#confirmEventInterface").show();
	}
}

function confirmEventOpt(){
	var eventid=eval(jQ("#inf_interest_confirm").data("eventid"));
	var liid=jQ("#inf_interest_confirm").data("liid");
	var btnObj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"eventAjax!confirmEvent.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data.result){
				jQ("#confirmEventInterface").hide();
				jQ("#inf_interestlist").empty();
				var detailobj=jQ("#"+liid).find("div.detail");
				var detaillistobj=detailobj.find("ul.detaillist");
				var lastobj=detaillistobj.find("li.last");
				var topobj=lastobj.find("div.top");
				
				var arrowboxobj=lastobj.find("div.arrow_box");
				topobj.append("<img src=\""+jQ("#ctxVal").val()+"/image/confirmevent_status.png\"></img>");
				arrowboxobj.find("span.info").text("参加的好友：");
				var ulobj=arrowboxobj.find("ul");
				ulobj.find("li[class!='iton']").remove();
				arrowboxobj.find("div.btnline").remove();
			}else{
				
			}
		}
	});
}

function closeConfirm_Inf(){
	jQ("#confirmEventInterface").hide();
	jQ("#inf_interestlist").empty();
	jQ("#inf_interest_confirm").removeData("eventid");
	jQ("#inf_interest_confirm").unbind("click");
}

function showCommentEvent(event){
	var liobj=jQ("#"+event.data.liid);
	liobj.find("div.detail").find("div.btnzone").find("div.commentline").toggle();
}

function addNewComment(obj){
	var commentlineobj=jQ(obj).parent();
	var btnzoneobj=commentlineobj.parent();
	var detailobj=btnzoneobj.parent();
	var liobj=detailobj.parent();
	var reliedclip=eval(liobj.data("reliedclip"));
	var dealeventid=0;
	if(reliedclip>0){
		dealeventid=reliedclip;
	}else{
		dealeventid=eval(liobj.data("eventid"));
	}
	var replyobj=jQ(obj).prev();
	var content=jQ.trim(replyobj.val());
	if(content==null||content.length==0){
		clip_tips("回复内容不能为空。");
	}else{
		if(content.length>255)
			clip_tips("回复内容不能超过255个字符。"); 
	}
	jQ.ajax({
		type: "POST",
		url:"eventAjax!addreply.action",
		data:{
			eventid:dealeventid,
			content:content
		},
		success:function(data){
			if(data.result){
				btnzoneobj.find("div.commentline").toggle();
				replyobj.val("");
				var firstline=btnzoneobj.find("div:first");
				var commentbtn=firstline.find("a.comment");
				var commentcount=commentbtn.attr("count");
				commentcount++;
				var commentcountstr=commentcount>99999?"99999+":""+commentcount;
				commentbtn.text("评论("+commentcountstr+")");
//				var temphtml="";
//				temphtml+="<a class=\"timeset\">设置提醒</a>";
//				clockobj.nextAll().remove();
//				clockobj.after(temphtml);
//				clockobj.removeClass("clock").addClass("clockoff");
//				clockobj.next().unbind("click").bind("click",{liid:liid},setclockClipevent);
			}else{
				
			}
		}
	});
}

function interestClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!interestShareEvent.action",
		data:{
			eventid:eval(eventid)
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					liobj.data("eventisinterested",1);
					liobj.find("div.simple").css("background","#fde9eb");
					var eventtype=eval(liobj.data("eventtype"));
					var seid=eval(liobj.data("seid"));
					var reliedclip=eval(liobj.data("reliedclip"));
					if(eventtype==2&&(seid==0||reliedclip==seid)){
						var interestcount=eval(liobj.data("interestcount"));
						interestcount++;
						liobj.data("interestcount",interestcount);
						var interestcountstr=interestcount>99999?"99999+":""+interestcount;
						btnobj.text("取消感兴趣("+interestcountstr+")");
					}else{
						btnobj.text("取消感兴趣");
					}
					
					
					btnobj.removeClass().addClass("interest").attr("title","取消对该档期的感兴趣");
					btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},uninterestClipevent);
					btnobj.parent().find("a.msgopen").remove();
					var temphtml="";
					temphtml+="<div class=\"setclock\">";
					temphtml+="<div class=\"middle\">";
					temphtml+="<i class=\"clockoff\"></i>";
					temphtml+="<a class=\"timeset\">设置提醒</a>";
					temphtml+="</div>";
					temphtml+="</div>";
					btnobj.parent().find("a:last").after(temphtml);
					btnobj.parent().find("div.setclock").find("div.middle a.timeset").unbind("click").bind("click",{liid:liobj.attr("id")},setclockClipevent);
					
					var btnzoneobj=btnobj.parent().parent();
					var ulobj=btnzoneobj.prevAll("ul.detaillist");
					var lilast=ulobj.find("li.last");
					var arrowbox=lilast.find("div.arrow_box");
					var userlistul=arrowbox.find("ul");
					userlistul.find("li:first").addClass("iton");
				}else{
					alert(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}

function uninterestClipevent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	var reliedclip=eval(liobj.data("reliedclip"));
	var dealeventid=0;
	if(reliedclip>0)
		dealeventid=reliedclip;
	else
		dealeventid=eventid;
	var btnobj=jQ(this);
	jQ.ajax({
		type: "POST",
		url:"shareAjax!uninterestShareEvent.action",
		data:{
			eventid:dealeventid
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					var queryby=jQ("#calendarlist").data("calendarquerytype");
					if(queryby=="own"){
						var btnzoneobj=btnobj.parent().parent();
						var ulobj=btnzoneobj.prevAll("ul.detaillist");
						var divdetail=ulobj.parent();
						divdetail.parent().hide( "clip", {}, 1000, function(){
							divdetail.parent().remove();
						} );
					}else if(queryby=="cc"){
						liobj.data("eventisinterested",0);
						liobj.find("div.simple").css("background","#ffffff");
						btnobj.removeClass().addClass("uninterest").attr("title","表示对该档期的感兴趣");
						btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
						btnobj.parent().find("div.setclock").remove();
						var interestcount=eval(liobj.data("interestcount"));
						interestcount--;
						liobj.data("interestcount",interestcount);
						var interestcountstr=interestcount>99999?"99999+":""+interestcount;
						btnobj.text("感兴趣("+interestcountstr+")");
					}else{
						liobj.data("eventisinterested",0);
						liobj.find("div.simple").css("background","#ffffff");
						btnobj.parent().children("a:last").after("<a title=\"不再提示该档期的提示\" class=\"msgopen\">不再提示</a>");
						btnobj.removeClass().addClass("uninterest").attr("title","表示对该档期的感兴趣");
						btnobj.unbind("click").bind("click",{liid:liobj.attr("id")},interestClipevent);
						btnobj.parent().find("div.setclock").remove();
						btnobj.text("感兴趣");
						var btnzoneobj=btnobj.parent().parent();
						var ulobj=btnzoneobj.prevAll("ul.detaillist");
						var lilast=ulobj.find("li.last");
						var arrowbox=lilast.find("div.arrow_box");
						var userlistul=arrowbox.find("ul");
						userlistul.find("li:first").removeClass("iton");
						btnobj.parent().find("a.msgopen").unbind("click").bind("click",{liid:liobj.attr("id")},shieldClipmessage);
					}
				}else{
					clip_tips(dataObj.msg);
					window.location.reload();
				}
			}
		}
	});
}



function initDetailTimeCalendar(starttime,iswholeday,endtime,calendarzoneobj){
	var startdate=new Date();
	startdate.setTime(starttime);
	var year=startdate.getFullYear();
	var month=startdate.getMonth();
	startdate=new Date(year,month,startdate.getDate());
	var enddate;
	var issameday=false;
	if(!iswholeday){
		enddate=new Date();
		enddate.setTime(endtime);
		enddate=new Date(enddate.getFullYear(),enddate.getMonth(),enddate.getDate());
		issameday=startdate.getTime()==enddate.getTime();
	}else{
		issameday=true;
	}
	detailtimemonth(null,startdate,enddate,issameday,year,month,calendarzoneobj);
	calendarzoneobj.show();
}

function detailtimemonth(event,startdate,enddate,issameday,year,month,calendarzoneobj){
	if(typeof(startdate)=='undefined'){
		startdate=event.data.startdate;
		issameday=event.data.issameday;
		enddate=event.data.enddate;
		month=event.data.month;
		year=event.data.year;
		calendarzoneobj=event.data.calendarzoneobj;
	}
	var firstDateOfMonth=new Date(year,month,1);
	var title=firstDateOfMonth.pattern("yyyy年MM月");
	calendarzoneobj.find("div.title span.title").empty().append(title);
	var week2=firstDateOfMonth.getDay();
	var week1=0;
	var startfromdate=new Date(year,month,1);
	if(week2>week1){
		startfromdate.setDate(firstDateOfMonth.getDate() -week2);
	}
	var endyear,endmonth;
	if(month==11){
		endmonth=0;
		endyear=year+1;
	}else{
		endmonth=month+1;
		endyear=year;
	}
	
	var endDateOfMonth=new Date(endyear,endmonth,1);
	endDateOfMonth.setDate(endDateOfMonth.getDate() -1);
	var week6=6;
	var week5=endDateOfMonth.getDay();
	
	
	var endtodate=new Date(endyear,endmonth,1);
	endtodate.setDate(endtodate.getDate() -1);
	if(week5<week6){
		endtodate.setDate(endDateOfMonth.getDate()+ (week6-week5));
	}
	var index=0;
	
	while(startfromdate.getTime()<=endtodate.getTime()){
		var tdobj=calendarzoneobj.find("td[tid=tddetail"+index+"]");
		tdobj.empty().append(startfromdate.getDate());
		tdobj.removeClass();
		if(startfromdate.getMonth()!=firstDateOfMonth.getMonth()){
			if(!issameday){
				if(startfromdate.getTime()>=startdate.getTime()&&startfromdate.getTime()<enddate.getTime()+1){
					tdobj.addClass("selected");
				}else{
					tdobj.addClass("other");
				}
			}else{
				tdobj.addClass("other");
			}
		}else{
			if(issameday){
				if(startfromdate.getTime()==startdate.getTime()){
					tdobj.addClass("selected");
				}
			}else{
				if(startfromdate.getTime()>=startdate.getTime()&&startfromdate.getTime()<enddate.getTime()+1){
					tdobj.addClass("selected");
				}
			}
		}
		index++;
		startfromdate.setDate(startfromdate.getDate() +1);
	}
	if(index==28){
		calendarzoneobj.find("tr[line=4]").hide();
	}else if(index==35){
		calendarzoneobj.find("tr[line=4]").show();
		calendarzoneobj.find("tr[line=5]").hide();
	}else{
		calendarzoneobj.find("tr[line=4]").show();
		calendarzoneobj.find("tr[line=5]").show();
	}
	
	if(issameday){
		calendarzoneobj.find("div.title a").addClass("none");
	}else{
		if(startdate.getTime()<firstDateOfMonth.getTime()){
			var temp1=new Date(firstDateOfMonth.getFullYear(),firstDateOfMonth.getMonth(),firstDateOfMonth.getDate());
			temp1.setMonth(temp1.getMonth()-1);
			var tempyear=temp1.getFullYear();
			var tempmonth=temp1.getMonth();
			calendarzoneobj.find("div.title a.prev").removeClass("none").unbind("click")
				.bind("click",{startdate:startdate,enddate:enddate,issameday:issameday,year:tempyear,month:tempmonth,calendarzoneobj:calendarzoneobj},detailtimemonth);
		}else{
			calendarzoneobj.find("div.title a.prev").addClass("none").unbind("click");
		}
		var tempdate=new Date(endDateOfMonth.getFullYear(),endDateOfMonth.getMonth(),endDateOfMonth.getDate());
		tempdate.setDate(tempdate.getDate()+ 1);
		if(enddate.getTime()>tempdate.getTime()){
			var tempyear=tempdate.getFullYear();
			var tempmonth=tempdate.getMonth();
			calendarzoneobj.find("div.title a.next").removeClass("none").unbind("click")
			.bind("click",{startdate:startdate,enddate:enddate,issameday:issameday,year:tempyear,month:tempmonth,calendarzoneobj:calendarzoneobj},detailtimemonth);
		}else{
			calendarzoneobj.find("div.title a.next").addClass("none").unbind("click");
		}
	}
}

function detailEvent(event){
	var liobj=jQ("#"+event.data.liid);
	var eventid=eval(liobj.data("eventid"));
	var isuserself=eval(jQ(liobj).data("isuserself"));
	var shareid=jQ(liobj).data("shareid");
	var cliptype=eval(jQ(liobj).data("cliptype"));
	if(isuserself){
		window.open(jQ("#ctxVal").val()+"/myclip/clip_detail.html?eventid="+eventid);
	}else if(cliptype==3){
		window.open(jQ("#ctxVal").val()+"/myclip/clip_detail.html?shareid="+shareid);
	}
}

function cancelshareclick(obj){
	var choosebtn=jQ(obj).parent();
	var zonecontent=choosebtn.parent();
	zonecontent.hide();
}

function confirmshareclick(obj){
	var btnobj=jQ(obj);
	var contactchoosebtn=jQ(obj).parent();
	var zonecontent=contactchoosebtn.parent();
	var arrow_box=zonecontent.parent();
	var elementliobj=arrow_box.parent();
	var ulobj=elementliobj.parent();
	var detailobj=ulobj.parent();
	var liobj=detailobj.parent();;
	var share_contactchooseout=contactchoosebtn.prevAll("div.share-contactchooseout");
	var listcontent=share_contactchooseout.find("ul.listcontent");
	var templength=listcontent.find("li").length;
	var sharelist='',mlist='';
	if(templength==0){
		clip_tips("请至少选择一名好友。");
		return false;
	}else{
		var tmphtml="";
		var listarr=new Array();
		listcontent.find("li").each(function(i){
			if(i==0)
				tmphtml=jQ(this).find("span.name").attr("uid")
			else{
				tmphtml+=","+jQ(this).find("span.name").attr("uid")
			}
			var mobileobj=jQ("div.opt",this).find("a.mobilemsgonit");
			var flag=mobileobj.length>0;
			if(flag){
				var mobilenotice=mobileobj.data("mobilenotice");
				if(mobilenotice){
					listarr.push(jQ("span.name",this).attr("uid"));
				}
			}
		});
		sharelist=tmphtml;
		mlist=listarr.toString();
	}
	
	var eventid=liobj.data("eventid");
	jQ.ajax({
		type: "POST",
		url:"shareAjax!forwardShareEvent.action",
		data:{
			eventid:eval(eventid),
			share2userlist:sharelist,
			mlist:mlist
		},
		success:function(data){
			if(data!=null){
				var dataObj=eval("("+data+")");//转换为json对象
				if(dataObj.result){
					zonecontent.find("div.add_return").prevAll().hide();
					listcontent.empty();
					btnobj.hide();
					zonecontent.find("div.add_return").show();
					var title=liobj.data("title");
					var beginlong=eval(liobj.data("starttime"));
					initShareOutofSite(zonecontent.find("div.add_return"),dataObj.shareid,title,beginlong);
				}else{
					
				}
			}
		}
	});
	
}

function invitingOptReturnBox(obj,content){
	var obj_box = jQ(obj);
	var obj_offset = obj_box.offset();
	var msg_box = jQ("#msg_box");
	jQ("#msg_box_content").empty().append(content);
	var _top = obj_offset.top - msg_box.outerHeight()/2;
	var _left = obj_offset.left - msg_box.outerHeight()/2;
	msg_box.css({"top":_top+"px","left":_left+"px"}).show();
	msg_box.find("div.msg_note").animate({top: 20+'px'}, 500,function(){
		setTimeout(function(){
			msg_box.find("div.msg_note").animate({top: 100+'px'},500,function(){msg_box.hide();});
		},2000);
	});
}

function formateTimeMonthDate(daytime){
	var day=new Date();
	day.setTime(daytime);
	return day.pattern("MM月dd日");
}

function scrollToObject(obj){
	var t = obj;
    if(t != undefined && t.offset() != null){
	    //判断是否有DOCTYPE声明，有与没有，scrollTop不一样
	    /*var scrollPos;
	    if(typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
	        scrollPos = document.documentElement;
	    }
	    else if (typeof document.body != 'undefined') {
	        scrollPos = document.body;
	    }*/
	   
	    var next_top = t.offset().top;
	    //jQ(scrollPos).scrollTop(next_top-100);
	    jQ(document.documentElement).animate({ scrollTop : next_top-100 }, "normal");
	    jQ(document.body).animate({ scrollTop : next_top-100 }, "normal");
    }
}


function leavenotice(){
	return "";
}

function currentMonthClick(){
	var tY=eval(jQ("#divtodaydetailtime").data("year"));
	var tM=eval(jQ("#divtodaydetailtime").data("month"));
	jQ("#mouth_fun_view_year option[value='"+tY+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+tM+"']").attr("selected",true);
	var querytype=jQ("#calendarlist").data("calendarquerytype");
	var isss=false;
	if(querytype=="cc")
		isss=true;
	getEventsByMonth(tY, tM,isss,null);
}
function changeMonthView(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	var querytype=jQ("#calendarlist").data("calendarquerytype");
	var isss=false;
	if(querytype=="cc")
		isss=true;
	getEventsByMonth(year, month,isss,null);
	
}

function prevYearClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	year=year-1;
	var month=eval(jQ("#mouth_fun_view_month").val());
	jQ("#mouth_fun_view_year option[value='"+(year)+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function prevMonthClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	if(month==0){
		month=11;
		year=year-1;
	}else{
		month=month-1;
	}
	jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+month+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function nextMonthClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	var month=eval(jQ("#mouth_fun_view_month").val());
	if(month==11){
		month=0;
		year=year+1;
	}else{
		month=month+1;
	}
	jQ("#mouth_fun_view_year option[value='"+year+"']").attr("selected",true);
	jQ("#mouth_fun_view_month option[value='"+month+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}
function nextYearClick(){
	var year=eval(jQ("#mouth_fun_view_year").val());
	year=year+1;
	var month=eval(jQ("#mouth_fun_view_month").val());
	jQ("#mouth_fun_view_year option[value='"+(year)+"']").attr("selected",true);
	jQ("#mouth_fun_view_year").trigger("change");
}

function changelineStatus(effectid,obj){
	if(jQ(obj).hasClass("expandon")){
		jQ(obj).removeClass("expandon");
		jQ("#"+effectid).hide();
	}else{
		jQ(obj).addClass("expandon");
		jQ("#"+effectid).show();
	}
	
}

function initSubscribeList(){
	jQ("#subscribecliplist").empty();
	jQ("#subscribecliplist").data("ischeckall",false);
	jQ("#mycliplist").data("ischeckall",false);
	jQ.ajax({
		type: "POST",
		url: "userAjax!loadUserAllSubscribed.action",
		success:function(data){
			var html="";
			if(jQ("User",data).length>0){
				jQ("User",data).each(function(i){
					var uid=jQ(this).attr("id");
					var name=jQ(this).find("name").text();
					var length=getWordsLength(name,12);
					html+="<li class=\"none\" uid="+uid+">";
					html+="<span class=\"left\"></span>";
					html+="<div class=\"calendardata\">";
					html+="<span class=\"checkboxbtn\"  onclick='changeSubListCheckBox(this);'></span>";
					if(length>100){
						html+="<span class=\"cal_name limited\" title='"+name+"' >"+name+"</span>";
					}else{
						html+="<span class=\"cal_name\" title='"+name+"' >"+name+"</span>";
					}
					html+="<span class='v_icon' title='档期认证'></span>";
					html+="</div>";
					html+="</li>";
				});
				html+="<li class=\"last\" >";
				html+="<span class=\"left\" style='background:none;'></span>";
				html+="<div class=\"calendardata\">";
				html+="<a class=\"view\" onclick=\"setSubscribeCalendarView();\"></a>";
				html+="</div>";
				html+="</li>";
				jQ("#subscribecliplist").append(html);
			}else{
				html+="<li class=\"none\">";
				html+="<span class=\"left\"></span>";
				html+="<div class=\"calendardata\">";
				html+="<span class=\"cal_name\">还未订阅任何商家</span>";
				html+="</div>";
				html+="</li>";
				html+="<li class=\"last\" >";
				html+="<span class=\"left\" style='background:none;'></span>";
				html+="<div class=\"calendardata\">";
				html+="<span class=\"cal_name\">去 <a href='"+jQ("#ctxVal").val()+"/control/managesubscribe.html' style='font-weight:bold;'>管理订阅</a> 看看吧！</span>";
				html+="</div>";
				html+="</li>";
				jQ("#subscribecliplist").append(html);
				//html+="<tr><td><div class=\"userlogo\"></div><div class=\"content\"><a class=\"name\">暂无订阅</a></div></td><td></td><td></td><td></td><td></td></tr>";
				//jQ("#sublistcontent").append(html);
			}
		}
	});
	
}

function setMyAllCalendarView(){
	jQ("#subscribecliplist li div.calendardata").removeClass("selecton");
	jQ("#subscribecliplist li div.calendardata span.checkboxbtn").removeClass("checkboxbtnon");
	jQ("#subscribe_chooseall_btn").text("全选");
	var selectobj=jQ("#mycliplist li div.selecton");
	var liobj=selectobj.parent();
	if(liobj.attr("querymycalendar")=='own'){
		var usertype=eval(jQ("#var_usertype").val());
		if(usertype==1){
			jQ("#invitecount").show();
		}
		jQ("#daydetailhead li.nonequery").show();
	}else{
		jQ("#invitecount").hide();
		jQ("#alertcount").hide();
		jQ("#daydetailhead li.nonequery").hide();
	}
	
	var month=eval(jQ("#datedetailzone").data("month"));
	var year=eval(jQ("#datedetailzone").data("year"));
	var date=eval(jQ("#datedetailzone").data("date"));
	jQ("#daydetailhead").show();
	jQ("#daysubdetailhead").hide();
	var liquerymycalendar=liobj.attr("querymycalendar");
	jQ("#calendarlist").data("calendarquerytype",liquerymycalendar);
	if(liquerymycalendar=='share'){
		jQ("#daydetailrequest_tab").show();
		jQ("#daydetailrequest_tab span.clipcheckbox").bind("click",function(){
			if(jQ(this).hasClass("clipcheckboxon")){
				//取消全选
				jQ("#daydetailcontent li").each(function(){
					var simpleobj=jQ(this).find("div.simple");
					var checkbox=simpleobj.find("span.clipcheckbox");
					if(checkbox.hasClass("clipcheckboxon")){
						checkbox.removeClass("clipcheckboxon");
					}
				});
				jQ(this).removeClass("clipcheckboxon");
			}else{
				jQ("#daydetailcontent li").each(function(){
					var simpleobj=jQ(this).find("div.simple");
					var checkbox=simpleobj.find("span.clipcheckbox");
					if(!checkbox.hasClass("clipcheckboxon")){
						checkbox.addClass("clipcheckboxon");
					}
				});
				jQ(this).addClass("clipcheckboxon");
				//全选
			}
		});
		jQ("#daydetailrequest_tab button.invite").bind("click",function(){
			if(jQ("#daydetailcontent li").length==0){
				clip_tips("当前日期下没有好友“求活动”");
			}
			var count=0;
			var array=new Array();
			jQ("#daydetailcontent li").each(function(){
				var simpleobj=jQ(this).find("div.simple");
				var checkbox=simpleobj.find("span.clipcheckbox");
				if(checkbox.hasClass("clipcheckboxon")){
					count++;
					var uid=eval(jQ(this).data("unameid"));
					var flag=true;
					for(var i=0;i<array.length;i++){
						if(array[i]==uid){
							flag=false;
							break;
						}
					}
					if(flag){
						array.push(uid);
					}
					var str="";
					for(var i=0;i<array.length;i++){
						if(i==0){
							str+=array[i];
						}else{
							str+=","+array[i];
						}
					}
					var date=eval(jQ("#datedetailzone").data("date"));
					var month=eval(jQ("#datedetailzone").data("month"));
					var year=eval(jQ("#datedetailzone").data("year"));
					window.location.href=jQ("#ctxVal").val()+"/myclip/add_clip.html?year="+year+"&month="+(month+1)+"&day="+date+"&invites="+str;
				}
			});
			if(count==0){
				clip_tips("您还没有选择邀请的好友");
			}else{
				
			}
		});
		jQ("#daydetailhead").hide();
	}else{
		jQ("#daydetailrequest_tab").hide();
		jQ("#daydetailhead").show();
	}
	jQ("#datedetailzone").data("ids","");
	getEventsByMonth(year,month,false,date);
}

function setSubscribeCalendarView(){
	jQ("#calendarlist").data("calendarquerytype","cc");
	jQ("#daydetailrequest_tab").hide();
	var flag=false;
	jQ("#subscribecliplist li.none").each(function(){
		if(jQ(this).data("checked")){
			flag=true;
			return true;
		}
	});
	if(flag){
		jQ("#mycliplist li div.calendardata").removeClass("selecton");
//		jQ("#mycliplist li div span.cal_nameon").removeClass("cal_nameon");
		jQ("#subscribecliplist li div.calendardata").removeClass("selecton");
		var ids="";
		var name="";
		jQ("#subscribecliplist li.none").each(function(i){
			if(jQ(this).data("checked")){
				jQ(this).find("div").addClass("selecton");
				if(ids.length==0){
					ids=jQ(this).attr("uid");
					name=jQ(this).find("div").find("span.cal_name").text();
				}else{
					ids=ids+","+jQ(this).attr("uid");
				}
			}
		});
		if(ids.indexOf(",")<=0){
			jQ("#daysubdetailhead li").empty().append(name+"的订阅");
		}else{
			jQ("#daysubdetailhead li").empty().append("多个订阅");
		}
		var date=eval(jQ("#datedetailzone").data("date"));
		var month=eval(jQ("#datedetailzone").data("month"));
		var year=eval(jQ("#datedetailzone").data("year"));
		jQ("#datedetailzone").data("ids",ids);
		jQ("#daydetailhead").hide();
		jQ("#daysubdetailhead").show();
		getEventsByMonth(year,month,true,date);
		
	}else{
		alert("请至少选择一个订阅日历");
	}
	
}

function initDaySubscribeDetailClip(year,month,date,isneedcloseloading){
	//jQ(window.document).unbind("scroll",listenScroll);
	jQ("#datedetailzone").data("date",date);
	jQ("#datedetailzone").data("month",month);
	jQ("#datedetailzone").data("year",year);
	var ids=jQ("#datedetailzone").data("ids");
	jQ("#daydetailcontent").empty();
	addLoadingLine();
	if(date==null){
		date=1;
	}
	jQ.ajax({
		type: "POST",
		url: "eventAjax!loadSubscribeEvents.action",
		data:{
			ids:ids,
			year:year,
			month:month,
			date:date
		},
		success:function(data){
			var length=jQ(data).find("ClipEvent").length;
			removeLoadingLine();
			if(length==0){
				var emptyhtml="";
				for(var i=0;i<5;i++){
					emptyhtml+="<li class=\"nodata\" >";
					emptyhtml+="<div class='simple'>";
					if(i==0){
						emptyhtml+="<span class=\"emptytxt\">暂无内容</span>";
					}
					emptyhtml+="</div>";
					emptyhtml+="</li>";
				}
				jQ("#daydetailcontent").append(emptyhtml);
			}else
				orgDayDetailClip(data,1);
			if(isneedcloseloading)
				jQ("#loadingui").hide();
		}
	});
}


function changeSubListCheckBox(obj){
	var liobj=jQ(obj).parent().parent();
	var btnobj;
	if(jQ(obj).hasClass("cal_name")){
		btnobj=jQ(obj).prev();
	}else{
		btnobj=jQ(obj);
	}
	if(btnobj.hasClass("checkboxbtnon")){
		btnobj.removeClass("checkboxbtnon");
		liobj.data("checked",false);
	}else{
		btnobj.addClass("checkboxbtnon");
		liobj.data("checked",true);
	}
	
}

function changeMyAllCheckBox(obj){
	var liobj=jQ(obj).parent().parent();
	var ulobj=liobj.parent();
	if(jQ(obj).hasClass("radiobtnon")){
		return;
	}else{
		ulobj.find("li span.radiobtn").removeClass("radiobtnon");
		ulobj.find("li").data("checked",false);
		jQ(obj).addClass("radiobtnon");
		liobj.data("checked",true);
	}
	
}

function changeAllStatus(id,obj){
	var ischeckall=eval(jQ("#"+id).data("ischeckall"));
	ischeckall=!ischeckall;
	jQ(obj).empty();
	if(ischeckall)
		jQ(obj).append("取消全选");
	else
		jQ(obj).append("全选");
	jQ("#"+id).data("ischeckall",ischeckall);
	jQ("#"+id).find("li[class!=last]").each(function(){
		jQ(this).data("checked",ischeckall);
		if(ischeckall){
			jQ(this).find("div.calendardata").find("span.checkboxbtn").addClass("checkboxbtnon");
		}else{
			jQ(this).find("div.calendardata").find("span.checkboxbtn").removeClass("checkboxbtnon");
		}
	})
}

function formateDetailTime(daytime){
	var temp=new Date();
	temp.setTime(daytime);
	return temp.pattern("yyyy/MM/dd");
}

function formateClockTime(daytime){
	var temp=new Date();
	temp.setTime(daytime);
	return temp.pattern("yyyy年MM月dd日 HH:mm");
}

function formatTimeAsString(daytime){
	return daytime.pattern("HH:mm");
}

function formateMemoDate(daytime){
	var temp=new Date();
	temp.setTime(daytime);
	return temp.pattern("MM月dd日");
}

function getWordsLength(words,fontsize){
	jQ("#fontwidthtools").css("font-size",fontsize+"px");
	jQ("#fontwidthtools").empty().append(words);
	return jQ("#fontwidthtools")[0].offsetWidth;
}

function resizeImgCSS(img){
	/*var LastestWIDTH=190;
	var LastestHEIGHT=150;*/
    if(typeof(img)!='object')
        img=document.getElementById(img);
    if(img==null)
        return;
    var image=document.createElement("img");
    image.onload=function (){
        var width=this.width;
        var height=this.height;
        if(width<60&&jQ(img).parent().hasClass("bigcursor")){
        	if(jQ(img).parent().hasClass("w_clippic"))
        		jQ(img).parent().removeClass("w_clippic");
        }else{
        	if(!jQ(img).parent().hasClass("w_clippic"))
        		jQ(img).parent().addClass("w_clippic");
        }
        jQ(img).fadeIn();
    };
    image.src=img.src;
}